Surface errors from Listener.StartAsync better

If CreateListenSocket fails, surface the original error instead of throwing a
NullReferenceException from Listener.Dispose().

#185
This commit is contained in:
Stephen Halter 2015-09-14 15:42:42 -07:00
parent 2d01f2752b
commit 47323a88e1
1 changed files with 1 additions and 1 deletions

View File

@ -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<int>();
Thread.Post(