Bug 9147 - [patch] Uri.GetComponent will fail with SystemException when called on a Uri created from an absolute path
Summary: [patch] Uri.GetComponent will fail with SystemException when called on a Uri ...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
Depends on:
Reported: 2012-12-27 23:15 UTC by David McFarland
Modified: 2015-10-13 11:08 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

patch with fix and test case (1.64 KB, patch)
2012-12-27 23:16 UTC, David McFarland
updated patch to fix style (1.65 KB, patch)
2012-12-27 23:19 UTC, David McFarland

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description David McFarland 2012-12-27 23:15:32 UTC
Here's a patch with a very simple test case:

new Uri(Environment.CurrentDirectory).GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped);

which will throw a SystemException on mono, but succeed on MS .net.

It also includes what I think is a reasonable fix to GetComponents().  When the scheme can't be determined from the Uri, it will assume a match with the parser object.
Comment 1 David McFarland 2012-12-27 23:16:03 UTC
Created attachment 3136 [details]
patch with fix and test case
Comment 2 David McFarland 2012-12-27 23:19:25 UTC
Created attachment 3137 [details]
updated patch to fix style
Comment 3 marcos.henrich 2015-10-13 11:08:08 UTC
Fixed in mono 4.0.