[Mono-bugs] [Bug 53236][Min] Changed - Trying to create a FileStream in a non-existant directory throws the wrong exception

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 2 Feb 2004 08:08:23 -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 iain@mccoy.id.au.

http://bugzilla.ximian.com/show_bug.cgi?id=53236

--- shadow/53236	2004-01-22 19:08:14.000000000 -0500
+++ shadow/53236.tmp.19086	2004-02-02 08:08:23.000000000 -0500
@@ -1,22 +1,21 @@
 Bug#: 53236
 Product: Mono/Class Libraries
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 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
@@ -53,6 +52,14 @@
 
 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)
+
+------- Additional Comments From iain@mccoy.id.au  2004-02-02 08:08 -------
+I'm attaching a patch that moves the check that raises the exception
+from File.Create to FileStream's constructor, where it runs whenever
+mode is FileMode.Create or FileMode.CreateNew.
+
+This is fine because File.Create just does some fiddling, largely
+argument checking, then creates a new FileStream with FileMode.Create