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

Gracefully fail if a Listener fails to start #185

Closed
halter73 opened this issue Sep 1, 2015 · 0 comments
Closed

Gracefully fail if a Listener fails to start #185

halter73 opened this issue Sep 1, 2015 · 0 comments
Assignees
Milestone

Comments

@halter73
Copy link
Member

halter73 commented Sep 1, 2015

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) 
...
@halter73 halter73 added the bug label Sep 1, 2015
@glennc glennc added this to the 1.0.0-rc1 milestone Sep 2, 2015
halter73 added a commit that referenced this issue Sep 14, 2015
If CreateListenSocket fails, surface the original error instead of throwing a
NullReferenceException from Listener.Dispose().

#185
@halter73 halter73 self-assigned this Sep 14, 2015
halter73 added a commit that referenced this issue Sep 17, 2015
If CreateListenSocket fails, surface the original error instead of throwing a
NullReferenceException from Listener.Dispose().

#185
@halter73 halter73 modified the milestones: 1.0.0-beta8, 1.0.0-rc1 Sep 17, 2015
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

2 participants