[Mono-bugs] [Bug 383905] New: Passing invalid filename chars to System.IO.FileInfo() yields different results in .NET vs. MonoWindows

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 25 15:51:04 EDT 2008


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


           Summary: Passing invalid filename chars to System.IO.FileInfo()
                    yields different results in .NET vs. MonoWindows
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jfrayne at blizzard.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


:, *, and ? are illegal in .NET on WinXP, while they are allowed in Mono on
WinXP. Also the exception messages are different. This test was performed on
the same machine and OS:

namespace FileInfoTest
{
        class Program
        {
                static void Main(string[] args)
                {
                        foreach (char illegalChar in
System.IO.Path.GetInvalidFileNameChars())
                        {
                                try
                                {
                                        string path = illegalChar.ToString();
                                        Console.Write(path + ": ");
                                        System.IO.FileInfo dir = new
System.IO.FileInfo(illegalChar.ToString());
                                        Console.WriteLine("No exception
thrown!");
                                }
                                catch (ArgumentException ex)
                                {
                                        Console.WriteLine(ex.GetType() + ": " +
ex.Message);
                                }
                        }
                        Console.Read();
                }
        }
}


Expected:

": System.ArgumentException: Illegal characters in path.
<: System.ArgumentException: Illegal characters in path.
>: System.ArgumentException: Illegal characters in path.
|: System.ArgumentException: Illegal characters in path.
 : System.ArgumentException: Illegal characters in path.
☺: System.ArgumentException: Illegal characters in path.
☻: System.ArgumentException: Illegal characters in path.
♥: System.ArgumentException: Illegal characters in path.
♦: System.ArgumentException: Illegal characters in path.
♣: System.ArgumentException: Illegal characters in path.
♠: System.ArgumentException: Illegal characters in path.
: System.ArgumentException: Illegal characters in path.
: System.ArgumentException: Illegal characters in path.
        : System.ArgumentException: The path is not of a legal form.

: System.ArgumentException: The path is not of a legal form.
♂: System.ArgumentException: The path is not of a legal form.
♀: System.ArgumentException: The path is not of a legal form.
: System.ArgumentException: The path is not of a legal form.
♫: System.ArgumentException: Illegal characters in path.
☼: System.ArgumentException: Illegal characters in path.
►: System.ArgumentException: Illegal characters in path.
◄: System.ArgumentException: Illegal characters in path.
↕: System.ArgumentException: Illegal characters in path.
‼: System.ArgumentException: Illegal characters in path.
¶: System.ArgumentException: Illegal characters in path.
§: System.ArgumentException: Illegal characters in path.
▬: System.ArgumentException: Illegal characters in path.
↨: System.ArgumentException: Illegal characters in path.
↑: System.ArgumentException: Illegal characters in path.
↓: System.ArgumentException: Illegal characters in path.
→: System.ArgumentException: Illegal characters in path.
←: System.ArgumentException: Illegal characters in path.
∟: System.ArgumentException: Illegal characters in path.
↔: System.ArgumentException: Illegal characters in path.
▲: System.ArgumentException: Illegal characters in path.
▼: System.ArgumentException: Illegal characters in path.
:: System.ArgumentException: The path is not of a legal form.
*: System.ArgumentException: Illegal characters in path.
?: System.ArgumentException: Illegal characters in path.
\: No exception thrown!
/: No exception thrown!

Actual:

 : System.ArgumentException: path
Parameter name: Invalid characters in path.
☺: System.ArgumentException: path
Parameter name: Invalid characters in path.
☻: System.ArgumentException: path
Parameter name: Invalid characters in path.
♥: System.ArgumentException: path
Parameter name: Invalid characters in path.
♦: System.ArgumentException: path
Parameter name: Invalid characters in path.
♣: System.ArgumentException: path
Parameter name: Invalid characters in path.
♠: System.ArgumentException: path
Parameter name: Invalid characters in path.
: System.ArgumentException: path
Parameter name: Invalid characters in path.
: System.ArgumentException: path
Parameter name: Invalid characters in path.
        : System.ArgumentException: path
Parameter name: Invalid characters in path.

: System.ArgumentException: path
Parameter name: Invalid characters in path.
♂: System.ArgumentException: path
Parameter name: Invalid characters in path.
♀: System.ArgumentException: path
Parameter name: Invalid characters in path.
: System.ArgumentException: path
Parameter name: Invalid characters in path.
♫: System.ArgumentException: path
Parameter name: Invalid characters in path.
☼: System.ArgumentException: path
Parameter name: Invalid characters in path.
►: System.ArgumentException: path
Parameter name: Invalid characters in path.
◄: System.ArgumentException: path
Parameter name: Invalid characters in path.
↕: System.ArgumentException: path
Parameter name: Invalid characters in path.
‼: System.ArgumentException: path
Parameter name: Invalid characters in path.
¶: System.ArgumentException: path
Parameter name: Invalid characters in path.
§: System.ArgumentException: path
Parameter name: Invalid characters in path.
▬: System.ArgumentException: path
Parameter name: Invalid characters in path.
↨: System.ArgumentException: path
Parameter name: Invalid characters in path.
↑: System.ArgumentException: path
Parameter name: Invalid characters in path.
↓: System.ArgumentException: path
Parameter name: Invalid characters in path.
→: System.ArgumentException: path
Parameter name: Invalid characters in path.
←: System.ArgumentException: path
Parameter name: Invalid characters in path.
∟: System.ArgumentException: path
Parameter name: Invalid characters in path.
↔: System.ArgumentException: path
Parameter name: Invalid characters in path.
▲: System.ArgumentException: path
Parameter name: Invalid characters in path.
▼: System.ArgumentException: path
Parameter name: Invalid characters in path.
": System.ArgumentException: path
Parameter name: Invalid characters in path.
<: System.ArgumentException: path
Parameter name: Invalid characters in path.
>: System.ArgumentException: path
Parameter name: Invalid characters in path.
|: System.ArgumentException: path
Parameter name: Invalid characters in path.
:: No exception thrown!
*: No exception thrown!
?: No exception thrown!
\: No exception thrown!
/: No exception 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