[Mono-bugs] [Bug 42991][Wis] New - DirectoryInfo.Parent throws ArgumentNullException when no parent

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 14 May 2003 13:09:27 -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 joe@tgpr.org.


--- shadow/42991	Wed May 14 13:09:27 2003
+++ shadow/42991.tmp.16589	Wed May 14 13:09:27 2003
@@ -0,0 +1,53 @@
+Bug#: 42991
+Product: Mono/Runtime
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: joe@tgpr.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: DirectoryInfo.Parent throws ArgumentNullException when no parent
+Description of Problem:
+When a DirectoryInfo has no parent and you call the DirectoryInfo.Parent
+property a System.ArgumentNullException is thrown.
+A test program can be found here: http://www.tgpr.org/Test.cs
+I ran this test on MS .NET and it worked as expected. The result of the
+program should list the directories in reverse (from root to current) from
+the current directory.
+Steps to reproduce the problem:
+1. Create a DirectoryInfo object with a root directory
+2. Call the Parent property of that object
+3. Prepare for a System.ArgumentNullException
+Actual Results:
+Unhandled Exception: System.ArgumentNullException: Argument cannot be null
+in <0x00030> 00 System.IO.FileSystemInfo:CheckPath (string)
+in <0x00066> 08 System.IO.FileSystemInfo:CheckPath (string)
+in <0x0001f> 00 System.IO.DirectoryInfo:.ctor (string)
+in <0x00031> 00 System.IO.DirectoryInfo:get_Parent ()
+in <0x00057> 08 System.IO.DirectoryInfo:get_Parent ()
+Expected Results:
+DirectoryInfo.Parent should return null
+How often does this happen?