Skip to content

Urls in settings require a port #1477

Description

@DavidJohnWilliams

Describe the bug

If you use the Urls setting and don't supply a port, when starting under ASP.Net Core you receive a timeout error.

The actual error is a NRE from this line:

if (originalScheme!.StartsWith("grpc", StringComparison.OrdinalIgnoreCase))

PortUtils.TryExtract has null annotations to say that the scheme out parameter will be null if TryExtract returns false, but there is a null-forgiving operator on the next line so you get a NRE.

Expected behavior:

Either no port is allowed and the code above should not run if TryExtract returns false; or the docs should be updated to explain that port is required on entries in Urls.

Test to reproduce

  • 1 - Add a url to Urls without a port
  • 2 - Start the server

Other related info

Side note: The exception thrown from Start is a timeout rather than the actual exception that occurred which made debugging the issue more difficult. It would be good to solve that as well.

BTW, I am happy to create a PR for this, but I'm raising the issue first for discussion.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions