Skip to content

Commit

Permalink
Fix race condition in Hosting test
Browse files Browse the repository at this point in the history
Change Task.Delay(1) to Task.Yield() to avoid a super race condition.

Fix dotnet#43389
  • Loading branch information
eerhardt committed Nov 11, 2020
1 parent 1625da3 commit 5655eaf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ private class AsyncThrowingService : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await Task.Delay(1);
await Task.Yield();

throw new Exception("Background Exception");
}
Expand Down

0 comments on commit 5655eaf

Please sign in to comment.