Re: Intermittent Incorrect Result on System.IO.Directory.Exists
Marc Brooks <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
I suspect that this is the same thing you had before, namely that a
directory was being deleted, but not all file handles against the
directory had been closed yet. In that case, the remove-directory is
queued and will execute when the last handle is closed. If during that
queued-delete time, you check if the directory exists it will return
FALSE, but if you try to create the directory it will already exist.
Make sure all your file access streams/handles are properly being
disposed... I recommend a using(Stream file = xxx) { } block.
Marc
On Thu, Oct 9, 2008 at 13:34, 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.
>
>
>
> Any help would be appreciated.
>
>
>
>
>
> [1] BugTracker.NET
>
>
> ===================================
> View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
>
--
Marc C. Brooks
http://musingmarc.blogspot.com
NOT sent from an iPhone
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives