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

Gracefully fail if a Listener fails to start #185

Closed
@halter73

Description

@halter73

If a Listener throws from CreateListenSocket (because the port is already in use for example), then a NullReferenceException is thrown from the Listener's dispose method that hides the original exception.

Example error:

C:\kestrel\CoreCLRMulti>.\kestrel
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.AspNet.Server.Kestrel.Http.Listener`1.<>c__DisplayClass10_0.<Dispose>b__0(Object _)

Unhandled Exception: System.ObjectDisposedException: Safe handle has been closed
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.async_send(UvAsyncHandle handle) 
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions