[Mono-bugs] [Bug 496783] New: System.Uri.GetComponents(UriComponents, UriFormat throws NullReference exception on valid uri

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 21 03:50:39 EDT 2009


           Summary: System.Uri.GetComponents(UriComponents, UriFormat
                    throws NullReference exception on valid uri
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: christian.vecchiola at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

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

The method Uri.GetComponents throws a NullReferenceException when trying to
extract the LocalPath component of the Uri. The strange thing is that the
property Uri.LocalPath, which is the one returned by the method call:
{uri-variable}.GetComponents(UriComponents.Path, UriFormat.UriEscaped), is
shown properly. 
The behavior I am describing can be reproduced by compiling the attached code.
The .NET 2.0 implementation returns the value of LocalPath without the '/'
character at the beginning of the string.  

Reproducible: Always

Steps to Reproduce:
1. use the following uri = tcp://csve2.csse.unimelb.edu.au:9090/Aneka
2. create a new instance of Uri: Uri test = new Uri(uri);
3. extract the local path by using the GetComponents method: string path =
uri.Getcomponents(UriComponents.Path, UriFormat.UriEscaped);

Actual Results:  
A System.NullReferenceException is thrown by the method invocation

Expected Results:  
the path variable should be equal to "Aneka"

run the compiled program with the following:

gmcs /r:System.dll /target:exe /main:TestCode.Uri.Program /out:UriTest.exe
mono UriTest.exe tcp://csve2.csse.unimelb.edu.au:9090/Aneka

Configure bugmail: http://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