[Mono-bugs] [Bug 76191][Nor] Changed - Wrong and invalid
DirectoryInfo.Parent values on Windows
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Sep 27 21:02:36 EDT 2005
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 kornelpal at hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76191
--- shadow/76191 2005-09-27 16:00:10.000000000 -0400
+++ shadow/76191.tmp.19646 2005-09-27 21:02:36.000000000 -0400
@@ -11,13 +11,13 @@
AssignedTo: mono-bugs at ximian.com
ReportedBy: kornelpal at hotmail.com
QAContact: mono-bugs at ximian.com
TargetMilestone: ---
URL:
Cc:
-Summary: OpenFileDialog.ShowDialog() leak
+Summary: Wrong and invalid DirectoryInfo.Parent values on Windows
Code to reproduce bug:
class OpenFileDialogBug
{
static void Main()
{
@@ -72,6 +72,67 @@
Where is this code running?
I tried running it on /tmp and it terminates fine.
------- Additional Comments From peter at novonyx.com 2005-09-27 15:52 -------
You ran on a Windows machine? Note the OS: Windows XP
+
+------- Additional Comments From kornelpal at hotmail.com 2005-09-27 21:02 -------
+The above described infinite loop is caused by the unexpected
+behaviour that DirectoryInfo.Parent returns the root path for the
+root path instead of null. In addition it returns C:\\ that is an
+accepted but non-canonicalized form of C:\.
+
+Code:
+using System;
+using System.IO;
+
+class DirectoryInfoParentBug
+{
+ static void Main()
+ {
+ DirectoryInfo parent;
+
+ Directory.SetCurrentDirectory
+(@"C:\WINDOWS\system32");
+
+ parent = new DirectoryInfo(@"C:").Parent;
+ Console.WriteLine(parent == null ? "<null>" :
+parent.FullName);
+
+ parent = new DirectoryInfo(@"C:\").Parent;
+ Console.WriteLine(parent == null ? "<null>" :
+parent.FullName);
+
+ parent = new DirectoryInfo(@"C:\dir").Parent;
+ Console.WriteLine(parent == null ? "<null>" :
+parent.FullName);
+
+ parent = new DirectoryInfo(@"C:\dir\").Parent;
+ Console.WriteLine(parent == null ? "<null>" :
+parent.FullName);
+
+ parent = new DirectoryInfo(@"C:\dir\dir").Parent;
+ Console.WriteLine(parent == null ? "<null>" :
+parent.FullName);
+
+ parent = new DirectoryInfo(@"C:\dir\dir\").Parent;
+ Console.WriteLine(parent == null ? "<null>" :
+parent.FullName);
+ }
+}
+
+Current results:
+<null>
+C:\\
+C:\\
+C:\dir
+C:\dir
+C:\dir\dir
+
+Expected results:
+C:\WINDOWS
+<null>
+C:\
+C:\
+C:\dir
+C:\dir
More information about the mono-bugs
mailing list