From 26dba434900992f638c41aabaf0e5a9836c01a1a Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 12 Nov 2020 05:32:28 -0600 Subject: [PATCH] Fix race condition in Hosting test (#44548) Change Task.Delay(1) to Task.Yield() to avoid a super race condition. Fix #43389 --- .../Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs index 6ea731c..80653a6 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs @@ -1372,7 +1372,7 @@ namespace Microsoft.Extensions.Hosting.Internal { protected override async Task ExecuteAsync(CancellationToken stoppingToken) { - await Task.Delay(1); + await Task.Yield(); throw new Exception("Background Exception"); } -- 2.7.4