[Mono-bugs] [Bug 45715][Nor] New - NullReferenceException in System.IO.Directory.GetFiles

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 1 Jul 2003 18:38:30 -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 mgrap@gmx.de.

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

--- shadow/45715	Tue Jul  1 18:38:30 2003
+++ shadow/45715.tmp.20225	Tue Jul  1 18:38:30 2003
@@ -0,0 +1,84 @@
+Bug#: 45715
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Mandrake 9.1
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mgrap@gmx.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException in System.IO.Directory.GetFiles
+
+Please fill in this template when reporting a bug, unless you know what you 
+are doing.
+Description of Problem:
+
+In Mono 0.25 System.IO.Directory.GetFiles throws a NullReferenceException 
+when it encounters file names which contain umlauts
+
+Steps to reproduce the problem:
+
+1. Create a directory named X and in that directory a few files, where at 
+least one of the files has a name that contains an umlaut (I used  and  
+to verify the problem)
+2. Compile the following C# program:
+
+class DirTest {
+        
+    public static void Main(string[] args)
+    {
+	string[] all_files_in_dir;
+	
+	if (args.Length != 1)
+	{
+	    System.Console.WriteLine("Usage: dirbug <directory>");
+	    return;
+	}
+	
+	all_files_in_dir = System.IO.Directory.GetFiles(args[0]);
+	
+	foreach(string file in all_files_in_dir)
+	    System.Console.WriteLine(file);
+	
+    }
+}
+
+3. Run the resulting program with the name of the directory X as the only 
+command line parameter.
+
+4. Rename the files in X so that none of the file names contains an Umlaut 
+and run the program again
+
+Actual Results:
+The first run (with Umlauts) results in:
+
+Unhandled Exception: System.NullReferenceException: A null value was found 
+where an object instance was required
+in (unmanaged) /usr/lib/libmono.so.0 [0x400ec4eb]
+in (unmanaged) /usr/lib/libmono.so.0 [0x400bb5be]
+in <0x0002e> 06 System.IO.MonoIO:FindNextFile (intptr,System.IO.
+MonoIOStat&,System.IO.MonoIOError&)
+in <0x00322> 00 System.IO.Directory:GetFileSystemEntries (string,string,
+System.IO.FileAttributes,System.IO.FileAttributes)
+in <0x0001a> 00 System.IO.Directory:GetFiles (string,string)
+in <0x00012> 00 System.IO.Directory:GetFiles (string)
+in <0x0005b> 00 .DirTest:Main (string[])
+
+The second run (without umlauts) lists the files in the directory as 
+expected
+
+Expected Results:
+
+The program should work with file names that contain umlauts
+
+How often does this happen? 
+Always
+
+Additional Information: