Bug 43032 - System.Uri cannot parse url with underscore at start
Summary: System.Uri cannot parse url with underscore at start
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.4.0 (C7)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks: 42985
  Show dependency tree
 
Reported: 2016-08-03 17:38 UTC by Matt Ward
Modified: 2016-10-06 09:21 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: Yes
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:
VERIFIED FIXED

Description Matt Ward 2016-08-03 17:38:04 UTC
To repro:

Create a console app that runs the following line of code:

    var uri = new Uri ("https://_foo/bar.html");


Expected result:

The url is parsed.


Actual result:

System.UriFormatException: Invalid URI: The hostname could not be parsed.
  at System.Uri.Parse (UriKind kind, System.String uriString) [0x00020] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System/Uri.cs:1306 
  at System.Uri.ParseUri (UriKind kind) [0x00000] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System/Uri.cs:1176 
  at System.Uri..ctor (System.String uriString, Boolean dontEscape) [0x00059] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System/Uri.cs:282 
  at System.Uri..ctor (System.String uriString) [0x00000] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System/Uri.cs:160 

On Windows the code works without any exception being thrown.


Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45 Wed Jul 27 16:20:13 EDT 2016)
Comment 1 Marek Safar 2016-08-09 17:55:37 UTC
Fixed in master and Mono 4.6