Fixing deadlock hang in test when running in single threaded environment

This commit is contained in:
John Luo 2015-12-14 10:02:27 -08:00
parent 3325bfc653
commit 455d865948
2 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ namespace Microsoft.AspNet.TestHost
} }
}); });
return await state.ResponseTask; return await state.ResponseTask.ConfigureAwait(false);
} }
private class RequestState private class RequestState

View File

@ -353,7 +353,7 @@ namespace Microsoft.AspNet.TestHost
[ConditionalFact] [ConditionalFact]
[FrameworkSkipCondition(RuntimeFrameworks.Mono, SkipReason = "Hangs randomly (issue #507)")] [FrameworkSkipCondition(RuntimeFrameworks.Mono, SkipReason = "Hangs randomly (issue #507)")]
public void CancelAborts() public async Task CancelAborts()
{ {
TestServer server = TestServer.Create(app => TestServer server = TestServer.Create(app =>
{ {
@ -365,7 +365,7 @@ namespace Microsoft.AspNet.TestHost
}); });
}); });
Assert.Throws<AggregateException>(() => { string result = server.CreateClient().GetStringAsync("/path").Result; }); await Assert.ThrowsAsync<TaskCanceledException>(async () => { string result = await server.CreateClient().GetStringAsync("/path"); });
} }
[ConditionalFact] [ConditionalFact]