[Mono-bugs] [Bug 59354][Blo] New - File.Exists incorrectly throws DirectoryNotFoundException for deeply nested files
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 31 May 2004 10:58:25 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by atsushi@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=59354
--- shadow/59354 2004-05-31 10:58:25.000000000 -0400
+++ shadow/59354.tmp.14728 2004-05-31 10:58:25.000000000 -0400
@@ -0,0 +1,56 @@
+Bug#: 59354
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: atsushi@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: File.Exists incorrectly throws DirectoryNotFoundException for deeply nested files
+
+On Win32, File.Exists throws an exception when we're trying to check the
+file existence those parent directory even does not exist.
+
+using System;
+using System.IO;
+
+public class Test
+{
+ public static void Main ()
+ {
+ Console.WriteLine (File.Exists ("c:\\msdos.sys"));
+ Console.WriteLine (File.Exists ("c:\\dygwin")); // just
+does not exist
+ Console.WriteLine (File.Exists
+("c:\\dygwin\\more-invalid-path"));
+ }
+}
+
+Actual results:
+
+Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a
+part
+ of the path "c:\dygwin\more-invalid-path"
+in <0x000a1> System.IO.File:Exists (string)
+in <0x0004b> Test:Main ()
+
+Expected Results:
+
+MS.NET does not throw an exception here, just returning False.
+
+How often does this happen?
+Always on Windows.
+
+Additional Information:
+It prevents us from GACing our new SharpZipLib.
+
+Maybe we should change some thing in
+ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error).