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(