From 47323a88e1c58f7e57c6f8c641415b2a992d22aa Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Mon, 14 Sep 2015 15:42:42 -0700 Subject: [PATCH] Surface errors from Listener.StartAsync better If CreateListenSocket fails, surface the original error instead of throwing a NullReferenceException from Listener.Dispose(). #185 --- src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs index 5b87d873a3..316c5318d9 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs @@ -82,7 +82,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http // If the event loop isn't running and we try to wait on this Post // to complete, then KestrelEngine will never be disposed and // the exception that stopped the event loop will never be surfaced. - if (Thread.FatalError == null) + if (Thread.FatalError == null && ListenSocket != null) { var tcs = new TaskCompletionSource(); Thread.Post(