Bug 30854 - Uri.TryCreate creates AbsoluteUri always (even in case of relative) with scheme as "file".
Summary: Uri.TryCreate creates AbsoluteUri always (even in case of relative) with sche...
Status: RESOLVED FEATURE
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
URL:
Depends on:
Blocks:
 
Reported: 2015-06-05 14:45 UTC by sornakumar
Modified: 2015-08-29 07:53 UTC (History)
4 users (show)

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

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:
Status:
RESOLVED FEATURE

Description sornakumar 2015-06-05 14:45:11 UTC
**Code**
public static void Main()
{
  Uri url;
  Uri.TryCreate("/Hello/World", UriKind.RelativeOrAbsolute, out url);
  Console.WriteLine(url.Scheme);
}

**End of Code**

The above piece of code throws "InvalidOperationException" in .NET but prints "file" in mono. It identifies the URI as Absolute instead of Relative.
Comment 1 Chris Hamons 2015-06-05 14:52:42 UTC
So MonoMac are the open source binding for writing desktop mac applications. This bug is not in the right location. Moving.
Comment 2 Daniel Lo Nigro 2015-08-16 02:24:31 UTC
As I mentioned in the ASP.NET MVC Github repo, this seems like expected behaviour. /Hello/World  is a valid absolute URI on Linux; it refers to the file located at /Hello/World.
Comment 3 marcos.henrich 2015-08-29 07:53:34 UTC
There is a doc explaining why the UriKind.RelativeOrAbsolute cannot be fixed
along with a workaround.

http://www.mono-project.com/docs/faq/known-issues/urikind-relativeorabsolute/