[Mono-bugs] [Bug 53260][Nor] New - System.Environment.GetFolderPath Throws Exceptions

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 23 Jan 2004 13:27:45 -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 jconley@winfessor.com.

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

--- shadow/53260	2004-01-23 13:27:45.000000000 -0500
+++ shadow/53260.tmp.26946	2004-01-23 13:27:45.000000000 -0500
@@ -0,0 +1,97 @@
+Bug#: 53260
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: Microsoft Windows Server 2003 Enterprise Edition
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jconley@winfessor.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Environment.GetFolderPath Throws Exceptions
+
+Description of Problem:
+The System.Environment.GetFolderPath() method throws 
+ArgumentNullExceptions in Windows.  GetFolderPath is very useful for 
+finding places to put temporary files.
+
+Steps to reproduce the problem:
+1. call System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.Personal)
+
+Here's a simple test case:
+using System;
+
+namespace BreakMono
+{
+	class GetFolderPath
+	{
+		static void Main(string[] args)
+		{
+			try
+			{
+				Console.WriteLine("personal: {0}", 
+System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.Personal));
+				Console.WriteLine("desktop: {0}", 
+System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.Desktop));
+				Console.WriteLine("localappdata: {0}", 
+System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.LocalApplicationData));
+				Console.WriteLine("desktop directory: 
+{0}", System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.DesktopDirectory));
+				Console.WriteLine("application data: {0}", 
+System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.ApplicationData));
+				Console.WriteLine("common application 
+data: {0}", System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.CommonApplicationData));
+				Console.WriteLine("common program files: 
+{0}", System.Environment.GetFolderPath
+(System.Environment.SpecialFolder.CommonProgramFiles));
+				Console.WriteLine("system: {0}", 
+System.Environment.GetFolderPath(System.Environment.SpecialFolder.System));
+				Console.WriteLine("Did the Folders Look 
+Correct?");
+			}
+			catch (Exception e)
+			{
+				Console.WriteLine("Test Failed With 
+Exception:");
+				Console.WriteLine(e.ToString());
+			}
+			finally
+			{
+				Console.WriteLine("Test Complete. Press 
+Any Key.");
+				Console.Read();
+			}
+		}
+	}
+}
+
+
+Actual Results:
+System.ArgumentNullException: Argument cannot be null
+Parameter name: path1
+in <0x00036> System.IO.Path:Combine (string,string)
+in <0x0004f> System.Environment:GetFolderPath 
+(System.Environment/SpecialFolder)
+
+Expected Results:
+The path to the current user's personal folder.
+
+How often does this happen? 
+Every Time
+
+Additional Information:
+This seems to work just fine on Linux.  Paths that do not exist on that 
+platform simply return an empty string.