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 (show other bugs)
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:


Attachments

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

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.


Create a new report for Bug 43032 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


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.

Related Links: