Re: Intermittent Incorrect Result on System.IO.Directory.Exists

Per Bolmstedt <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <LISTSERV%[email protected]>
On Thu, 9 Oct 2008 20:34:20 +0200, Brady Kelly <[email protected]> wrote:

>I'm getting an intermittent false negative on the call "if
>(!System.IO.Directory.Exists(folder))" in code in an ASP.NET 2 web site [1].
>The folder clearly exists, and even contains a log file that is written to
>when the CLR doesn't lie about the folder's existence.

This sounds exactly like the problem you had back in May:

> Date: Mon, 19 May 2008 19:42:33 +0200
> From: Brady Kelly <[email protected]>
> Subject: [DOTNET-CLR] Directory Ops Behaving Asynchronous
> 
> I have the following code execute:
>             if (Directory.Exists(exportFolder))
>             {
>                 Directory.Delete(exportFolder, true);
>             }
>             Directory.CreateDirectory(exportFolder);
> [...]
> 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.

How did that work out?

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.