Hi, 

I am seeing an issue with XmlDocument  .Load() always throwing an exception.
I have studied the code in the class library and noticed the following issue
that can be narrowed down to Uri.cs. 

    Path.GetFullPath("dev0:/dir1/dir2") => "//dev0:/dir1/dir2"
    Uri(Path.GetFullPath("dev0:/dir1/dir2")) => "file:///dev0:/dir1/dir2"

Note '///' in XmlDocument seems to cause a problem with FileStream which
throws and exception along the lines of can not find path
"/dev0:/dir1/dir2".

FileStream only seems happy seeing the following format: "dev0:/dir1/dir2"

Looking at Uri.cs I can see: 

                private void ParseAsUnixAbsoluteFilePath (string uriString)
                {
                        isUnixFilePath = true;
                        scheme = UriSchemeFile;
                        port = -1;
                        fragment = String.Empty;
                        query = String.Empty;
                        host = String.Empty;
                        path = null;

                        if (uriString.Length >= 2 && uriString [0] == '/' && 
uriString [1] ==
'/') {
                                uriString = uriString.TrimStart (new char [] 
{'/'});
                                // Now we don't regard //foo/bar as "foo" host.
                                /* 
                                int pos = uriString.IndexOf ('/');
                                if (pos > 0) {
                                        path = '/' + uriString.Substring (pos + 
1);
                                        host = uriString.Substring (0, pos);
                                } else { // "///server"
                                        host = uriString;
                                        path = String.Empty;
                                }
                                */
                                path = '/' + uriString;
                        }
                        if (path == null)
                                path = uriString;
                }


Why is the code doing:

    path = '/' + uriString;

After stripping the leading '//' ? 

I'm assuming at some point the library simply tags on or removes "file://"
as required.

Regards,
Shaun



--
View this message in context: 
http://mono.1490590.n4.nabble.com/Possible-issue-with-Uri-cs-tp4662793.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to