[Mono-bugs] [Bug 53236][Min] New - Trying to create a FileStream in a non-existant directory throws the wrong exception
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 22 Jan 2004 19:08:14 -0500 (EST)
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 dave-mono@earth.li.
http://bugzilla.ximian.com/show_bug.cgi?id=53236
--- shadow/53236 2004-01-22 19:08:13.000000000 -0500
+++ shadow/53236.tmp.20484 2004-01-22 19:08:14.000000000 -0500
@@ -0,0 +1,58 @@
+Bug#: 53236
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dave-mono@earth.li
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Trying to create a FileStream in a non-existant directory throws the wrong exception
+
+Description of Problem:
+
+If you use new FileStream(path, FileMode.CreateNew), to try to create a
+file in a directory that doesnt exist, MS.NET throws a
+DirectoryNotFoundException, Mono throws a FileNotFoundException.
+
+However if you use File.Create(path), Mono throws the correct exception.
+
+
+Steps to reproduce the problem:
+1.
+using System;
+using System.IO;
+
+class t1
+{
+ static void Main(string [] args ) {
+ string path = "NonExistantDirectory/NonExistantfile";
+ new FileStream (path, FileMode.CreateNew);
+ }
+}
+
+
+Actual Results:
+Unhandled Exception: System.IO.FileNotFoundException: Could not find file
+"NonExistantDirectory/NonExistantfile"
+in <0x002fd> System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool)
+in <0x00086> System.IO.FileStream:.ctor (string,System.IO.FileMode)
+in <0x00065> (wrapper remoting-invoke-with-check)
+System.IO.FileStream:.ctor (string,System.IO.FileMode)
+in <0x00037> .t1:Main (string[])
+
+
+
+Expected Results:
+Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a
+part
+ of the path "C:\temp\NonExistantDirectory\NonExistantfile".
+ at System.IO.__Error.WinIOError(Int32 errorCode, String str)