Occassionally, about 1 in 20 tests I run in the IDE, PerformExport fails because exportFolder does not exist. How can it not exist if I create it and no exception is thrown? I can only suspect that the Directory code is not truly synchronous, and has not completed before PerformExport executes.
-----Original Message----- From: Discussion of development on the .NET platform using any managed language [mailtoOTNET-CLR@DISCUSS.DEVELOP.COM] On Behalf Of Brady Kelly Sent: Monday, May 19, 2008 12:43 PM To: DOTNET-CLR@DISCUSS.DEVELOP.COM Subject: [DOTNET-CLR] Directory Ops Behaving Asynchronous
I have the following code execute:
if (Directory.Exists(exportFolder))
{
Directory.Delete(exportFolder, true);
}
Directory.CreateDirectory(exportFolder);
and then a database update, and then:
wiz57.PerformExport();
Occassionally, about 1 in 20 tests I run in the IDE, PerformExport fails because exportFolder does not exist. How can it not exist if I create it and no exception is thrown? I can only suspect that the Directory code is not truly synchronous, and has not completed before PerformExport executes.
I am unable to duplicate your issue ... Are you using a local or a
network drive? Can you provide your test application so I can look
through it?
Cheers,
Greg
It's a local drive, and I'm also unable to duplicate the issue _at will_. The test application is rather convoluted, as it's been something of a scripting, rather than development exercise, but I'll try and trim it down. Thanks.
=================================== This list is hosted by DevelopMentor http://www.develop.com
I'm unable to reproduce too ,in 10,000 iterations performing the actions you've described (except the database update). Can you provide the details of the exception?
Do you have an anti-virus programming running? What happens if you turn it off?
If there truly is no other threads or processes that are deleting that directory, I can't think of anything else that could cause that.
Is the directory a sub-directory of a shared directory? I once encountered someone with mysterious disappearing files because he had shared the directory and a user on another computer was performing housekeeping on what they thought was a local drive. But, about 1 in 20 seems a little too regular for that...
=================================== This list is hosted by DevelopMentor http://www.develop.com
I'm unable to reproduce too ,in 10,000 iterations performing the
actions
you've described (except the database update). Can you provide the
details of the exception?
I'll do some iterations myself and check the frequency. My initial 1 in 20 was very ballpark, I was running each test individually, not in an iterative set.
Do you have an anti-virus programming running? What happens if you
turn
it off?
I do have it running, and will check what happens when I turn it off.
=================================== This list is hosted by DevelopMentor http://www.develop.com
I'm seeing the same problem every once in a while when running a high number of automated tests (NUnit 2.2 or 2.4 in this case) with each test deleting and re-creating a directory: sometimes, directory creation fails immediately after the original was deleted. The IO exception claims that the old directory still exists. Everything is strictly sequential, no multithreading going on. The directory is a perfectly ordinary NTFS folder on a local hard drive (with RAID mirroring). And it happens on different PCs, so it's likely not a hardware issue.
It's not reproducible at all, so it's hard to find the cause of the issue (file system, virus scanner, .NET, ...). In fact, we decided to just work around this issue by running a short while-Directory.Exists loop after the delete operation, spinning until the directory is really gone. This "solves" the issue for our test suite, although a deeper explanation would be nice, of course.
Fabian
On 5/20/08, Peter Ritchie <dotnetclr.discuss.develop.com@peterritchie.com> wrote:
I'm unable to reproduce too ,in 10,000 iterations performing the actions
you've described (except the database update). Can you provide the
details of the exception?
Do you have an anti-virus programming running? What happens if you turn
it off?
If there truly is no other threads or processes that are deleting that
directory, I can't think of anything else that could cause that.
Is the directory a sub-directory of a shared directory? I once
encountered someone with mysterious disappearing files because he had
shared the directory and a user on another computer was performing
housekeeping on what they thought was a local drive. But, about 1 in 20
Could it be some sort of race condition with write-behind caching?
-----Original Message----- From: Discussion of development on the .NET platform using any managed language [mailtoOTNET-CLR@DISCUSS.DEVELOP.COM] On Behalf Of Fabian Schmied Sent: Friday, May 23, 2008 11:12 AM To: DOTNET-CLR@DISCUSS.DEVELOP.COM Subject: Re: [DOTNET-CLR] Directory Ops Behaving Asynchronous
I'm seeing the same problem every once in a while when running a high number of automated tests (NUnit 2.2 or 2.4 in this case) with each test deleting and re-creating a directory: sometimes, directory creation fails immediately after the original was deleted. The IO exception claims that the old directory still exists. Everything is strictly sequential, no multithreading going on. The directory is a perfectly ordinary NTFS folder on a local hard drive (with RAID mirroring). And it happens on different PCs, so it's likely not a hardware issue.
It's not reproducible at all, so it's hard to find the cause of the issue (file system, virus scanner, .NET, ...). In fact, we decided to just work around this issue by running a short while-Directory.Exists loop after the delete operation, spinning until the directory is really gone. This "solves" the issue for our test suite, although a deeper explanation would be nice, of course.
Fabian
On 5/20/08, Peter Ritchie <dotnetclr.discuss.develop.com@peterritchie.com> wrote:
I'm unable to reproduce too ,in 10,000 iterations performing the
actions
you've described (except the database update). Can you provide the
details of the exception?
Do you have an anti-virus programming running? What happens if you
turn
it off?
If there truly is no other threads or processes that are deleting that
directory, I can't think of anything else that could cause that.
Is the directory a sub-directory of a shared directory? I once
encountered someone with mysterious disappearing files because he had
shared the directory and a user on another computer was performing
housekeeping on what they thought was a local drive. But, about 1 in
Sebastien Lambla 23 May 2008 21:05:26 [ permanent link ]
I've had issues with some of my build scripts. While running procmon, I've seen the case where the folder appears deleted, but when a try on creating the folder, it gets an access denied with a DELETE PENDING status.
It may or may not be related, just thought I'd suggest to run procmon and see where you get an access denied. .net doesn't report some of them as accurately as one may expect.
Seb
-----Original Message----- From: Discussion of development on the .NET platform using any managed language [mailtoOTNET-CLR@DISCUSS.DEVELOP.COM] On Behalf Of Fabian Schmied Sent: 23 May 2008 17:12 To: DOTNET-CLR@DISCUSS.DEVELOP.COM Subject: Re: [DOTNET-CLR] Directory Ops Behaving Asynchronous
I'm seeing the same problem every once in a while when running a high number of automated tests (NUnit 2.2 or 2.4 in this case) with each test deleting and re-creating a directory: sometimes, directory creation fails immediately after the original was deleted. The IO exception claims that the old directory still exists. Everything is strictly sequential, no multithreading going on. The directory is a perfectly ordinary NTFS folder on a local hard drive (with RAID mirroring). And it happens on different PCs, so it's likely not a hardware issue.
It's not reproducible at all, so it's hard to find the cause of the issue (file system, virus scanner, .NET, ...). In fact, we decided to just work around this issue by running a short while-Directory.Exists loop after the delete operation, spinning until the directory is really gone. This "solves" the issue for our test suite, although a deeper explanation would be nice, of course.
Fabian
On 5/20/08, Peter Ritchie <dotnetclr.discuss.develop.com@peterritchie.com> wrote:
I'm unable to reproduce too ,in 10,000 iterations performing the actions
you've described (except the database update). Can you provide the
details of the exception?
Do you have an anti-virus programming running? What happens if you turn
it off?
If there truly is no other threads or processes that are deleting that
directory, I can't think of anything else that could cause that.
Is the directory a sub-directory of a shared directory? I once
encountered someone with mysterious disappearing files because he had
shared the directory and a user on another computer was performing
housekeeping on what they thought was a local drive. But, about 1 in 20
The "delete pending" error occurs if you delete a file or folder but there's still an active handle for that file or folder somewhere. I'm not clear whether that only occurs if the handle is in another application (like virus scanners) or in the same application (the one deleting the file/folder).
=================================== This list is hosted by DevelopMentor http://www.develop.com
Follow up: This only seems to happen when the directory is created just before calling a COM component that uses the directory. It has happened twice now on two tests. The first time I re-ran the test without error, before moving on to the next test instance, where I got the error again. Unfortunately this round of testing is about a hundred fold bigger than the last, and single test tasks run to tens of minutes.
2008/5/19, Brady Kelly <brady@chasesoftware.co.za>:
I have the following code execute:
if (Directory.Exists(exportFolder))
{
Directory.Delete(exportFolder, true);
}
Directory.CreateDirectory(exportFolder);
and then a database update, and then:
wiz57.PerformExport();
Occassionally, about 1 in 20 tests I run in the IDE, PerformExport
fails
because exportFolder does not exist. How can it not exist if I create
it and
no exception is thrown? I can only suspect that the Directory code is
not
truly synchronous, and has not completed before PerformExport
executes.
=================================== This list is hosted by DevelopMentor http://www.develop.com
Brad, I hit this a few years ago , if I remember correctly there was no solution, the only way was to itterate through the files collection and delete them individually.
hth
Davy J
On Mon, May 19, 2008 at 7:42 PM, Brady Kelly <brady@chasesoftware.co.za> wrote:
I have the following code execute:
if (Directory.Exists(exportFolder))
{
Directory.Delete(exportFolder, true);
}
Directory.CreateDirectory(exportFolder);
and then a database update, and then:
wiz57.PerformExport();
Occassionally, about 1 in 20 tests I run in the IDE, PerformExport fails
because exportFolder does not exist. How can it not exist if I create it and
no exception is thrown? I can only suspect that the Directory code is not
truly synchronous, and has not completed before PerformExport executes.
Brady Kelly
Software Developer
=================================== This list is hosted by DevelopMentor® http://www.develop.com
I had the same problem. C# ASP.net 3.5 still has this bug. About if you do Directory.Delete and then Remake the Directory about 1 time in 20 it fails on large tests
I have seen this behavior too, using .NET 2.0 runtime. In a unit test, I create a directory, then delete it via Directory.Delete(directory, true) in some business logic, and then in the unit test assert that Directory.Exists(directory) returns false. Sometimes it returns true instead, even though clearly the directory was deleted, as evidenced by examining it after the test completes. Thanks for making Directory.Delete(x, true) asynchronous, Microsoft! Not!
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .