Bug 40365 - System.Uri cannot understand guarded IPv6 addresses which MS.net supports
Summary: System.Uri cannot understand guarded IPv6 addresses which MS.net supports
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.2.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2016-04-13 21:29 UTC by Nathan Phillip Brink (binki)
Modified: 2016-05-11 10:29 UTC (History)
4 users (show)

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:

Description Nathan Phillip Brink (binki) 2016-04-13 21:29:02 UTC
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> new Uri("asfd://[::1]:123/").DnsSafeHost
System.UriFormatException: Invalid URI: The URI scheme is not valid.
  at System.Uri.Parse (UriKind kind, System.String uriString) <0x3b214d0 + 0x00097> in <filename unknown>:0
  at System.Uri.ParseUri (UriKind kind) <0x3b21400 + 0x0001f> in <filename unknown>:0
  at System.Uri..ctor (System.String uriString, Boolean dontEscape) <0x3b21268 + 0x00113> in <filename unknown>:0
  at System.Uri..ctor (System.String uriString) <0x3b21238 + 0x0001f> in <filename unknown>:0
  at <InteractiveExpressionClass>.Host (System.Object& $retval) <0x3b204c8 + 0x00033> in <filename unknown>:0
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) <0x3a8ed60 + 0x000ab> in <filename unknown>:0
  at Mono.CSharpShell.Evaluate (System.String input) <0x3a8ec78 + 0x00043> in <filename unknown>:0
csharp> new Uri("adsf://localhost:123/").DnsSafeHost

The error wrongly states that I specified a bad URI scheme.

I’m using Mono-

In MS.net, the expression “new Uri("asdf://[::1]:123/").DnsSafeHost” evaluates to “"::1"”.
Comment 1 Karl Nilsson 2016-05-04 13:09:35 UTC
This is present in mono 4.4 as well.
Comment 2 Marek Safar 2016-05-11 10:29:08 UTC
Fixed in master