Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

ServerAddress.FromUrl("http://") throws ArgumentOutOfRangeException #860

Closed
mikeharder opened this issue May 21, 2016 · 2 comments
Closed
Assignees
Milestone

Comments

@mikeharder
Copy link
Contributor

Repro

ServerAddress.FromUrl("http://")

Expected

Return either null or a valid ServerAddress

Actual

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Microsoft.AspNetCore.Server.Kestrel.ServerAddress.FromUrl(String url)
@mikeharder mikeharder self-assigned this May 21, 2016
@khellang
Copy link
Contributor

Don't you think it should throw something for invalid URLs? Returning null could lead to an equally vague NullReferenceException.

@Eilon Eilon added this to the 1.0.0 milestone May 24, 2016
@mikeharder
Copy link
Contributor Author

@khellang: Thanks for the suggestion, we agree ServerAddress.FromUrl() should throw instead of returning null. Tracked by #875.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants