diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/DeveloperExceptionPageMiddlewareTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/DeveloperExceptionPageMiddlewareTest.cs index 8a4e23b87b..bab6220d0e 100644 --- a/test/Microsoft.AspNet.Diagnostics.Tests/DeveloperExceptionPageMiddlewareTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Tests/DeveloperExceptionPageMiddlewareTest.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Reflection; using System.Runtime.Versioning; using System.Text; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.FileProviders; @@ -497,6 +498,9 @@ namespace Microsoft.AspNet.Diagnostics // Act await server.CreateClient().GetAsync("/path"); + // This ensures that all diagnostics are completely written to the diagnostic listener + Thread.Sleep(1000); + // Assert Assert.NotNull(listener.EndRequest?.HttpContext); Assert.Null(listener.HostingUnhandledException?.HttpContext); diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/ExceptionHandlerTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/ExceptionHandlerTest.cs index a6b595c7be..0a939252eb 100644 --- a/test/Microsoft.AspNet.Diagnostics.Tests/ExceptionHandlerTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Tests/ExceptionHandlerTest.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Net; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; @@ -354,6 +355,9 @@ namespace Microsoft.AspNet.Diagnostics // Act await server.CreateClient().GetAsync(string.Empty); + // This ensures that all diagnostics are completely written to the diagnostic listener + Thread.Sleep(1000); + // Assert Assert.NotNull(listener.EndRequest?.HttpContext); Assert.Null(listener.HostingUnhandledException?.HttpContext);