[Mono-bugs] [Bug 655656] New: System.Environment.GetFolderPath not fully supported in Mono 2.8.1

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 24 00:17:04 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=655656

https://bugzilla.novell.com/show_bug.cgi?id=655656#c0


           Summary: System.Environment.GetFolderPath not fully supported
                    in Mono 2.8.1
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: x86-64
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: s_lessard at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us)
AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4

The GetFolderPath method throws an exception when it is passed one of the new
enum values in the .NET 4.0 version of System.Environment.SpecialFolder.

Reproducible: Always

Steps to Reproduce:
1. Save the code below to ~/specialfolderstest.cs
2. Run the command: csharp ~/specialfolderstest.cs
3. See Actual Results section for output



Console.WriteLine("System.Environment.Version = " +
System.Environment.Version);
Console.WriteLine("{0,-25}  {1,-8}  {2}", "Name", "Value", "Result");
foreach (System.Environment.SpecialFolder atypeSpecialFolder in 
                     System.Enum.GetValues(typeof(Environment.SpecialFolder)))
   {
      var typeSpecialFolder = atypeSpecialFolder;
      string enumname = string.Empty;
      short enumvalue = 0;
      string result = string.Empty;

      try
      {
         enumname = typeSpecialFolder.ToString();
         enumvalue = ((short)typeSpecialFolder);
         result = System.Environment.GetFolderPath(typeSpecialFolder);
      }
      catch (Exception ex)
      {
          result = ex.Message;
      }
      Console.WriteLine("{0,-25}  {1,-8}  {2}", enumname, enumvalue, result);
   }

Actual Results:  
An ArgumentException is thrown when one of the new SpecialFolders enum values
is passed to the GetFolderPath method.


System.Environment.Version = 4.0.30319.1
Name                       Value     Result
Desktop                    0         /Users/slessard/Desktop
Programs                   2         
Personal                   5         /Users/slessard
Personal                   5         /Users/slessard
Favorites                  6         
Startup                    7         
Recent                     8         
SendTo                     9         
StartMenu                  11        
MyMusic                    13        /Users/slessard/Music
MyVideos                   14        Invalid SpecialFolder
DesktopDirectory           16        /Users/slessard/Desktop
MyComputer                 17        
NetworkShortcuts           19        Invalid SpecialFolder
Fonts                      20        Invalid SpecialFolder
Templates                  21        
CommonStartMenu            22        Invalid SpecialFolder
CommonPrograms             23        Invalid SpecialFolder
CommonStartup              24        Invalid SpecialFolder
CommonDesktopDirectory     25        Invalid SpecialFolder
ApplicationData            26        /Users/slessard/.config
PrinterShortcuts           27        Invalid SpecialFolder
LocalApplicationData       28        /Users/slessard/.local/share
InternetCache              32        
Cookies                    33        
History                    34        
CommonApplicationData      35        /usr/share
Windows                    36        Invalid SpecialFolder
System                     37        
ProgramFiles               38        
MyPictures                 39        /Users/slessard/Pictures
UserProfile                40        Invalid SpecialFolder
SystemX86                  41        Invalid SpecialFolder
ProgramFilesX86            42        Invalid SpecialFolder
CommonProgramFiles         43        
CommonProgramFilesX86      44        Invalid SpecialFolder
CommonTemplates            45        Invalid SpecialFolder
CommonDocuments            46        Invalid SpecialFolder
CommonAdminTools           47        Invalid SpecialFolder
AdminTools                 48        Invalid SpecialFolder
CommonMusic                53        Invalid SpecialFolder
CommonPictures             54        Invalid SpecialFolder
CommonVideos               55        Invalid SpecialFolder
Resources                  56        Invalid SpecialFolder
LocalizedResources         57        Invalid SpecialFolder
CommonOemLinks             58        Invalid SpecialFolder
CDBurning                  59        Invalid SpecialFolder


Expected Results:  
No exception is thrown

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list