[Mono-list] Possible bug checking existence of file or directory

Abe Gillespie abe.gillespie at gmail.com
Fri Nov 5 08:21:48 EDT 2010


Sorry, expected results - I would have expected an access violation
from the FileSystemWatcher.  But since it's official for .Net to act
like the path doesn't exist, then maybe the FileSystemWatcher is
behaving correctly.

Will all this said, there is one small bug with FileSystemWatcher.
When it throws the message is "Directory does not exists" (notice the
plurality).  I'll file it today.

-Abe

On Fri, Nov 5, 2010 at 5:27 AM, Stifu <stifu at free.fr> wrote:
>
> "Doing File.Exists() or Directory.Exists() on a file / dir that the
> running account doesn't have permission to causes this to return
> false.  This is somewhat understandable (but is it correct?)."
>
> This matches what MSDN says.
>
> "Return Value
> true if the caller has the required permissions and path contains the name
> of an existing file; otherwise, false."
>
> http://msdn.microsoft.com/en-us/library/system.io.file.exists%28v=VS.80%29.aspx
>
> I'm not sure about FileSystemWatcher throwing DirectoryNotFoundException,
> though.
>
> MSDN doesn't mention it (if we're indeed talking about the FileSystemWatcher
> constructor): http://msdn.microsoft.com/en-us/library/b36854c3.aspx
>
>
> Abe Gillespie wrote:
>>
>> If this is a bug I'll file it:
>>
>> Doing File.Exists() or Directory.Exists() on a file / dir that the
>> running account doesn't have permission to causes this to return
>> false.  This is somewhat understandable (but is it correct?).
>> However, doing a new FileSystemWatcher() on the same existing, but not
>> accessible dir, throws a DirectoryNotFoundException().  This seems a
>> little less understandable.  But I'm not sure.
>>
>> -Abe
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Possible-bug-checking-existence-of-file-or-directory-tp3028067p3028357.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>


More information about the Mono-list mailing list