Don't log an error when a BackgroundService is canceled due to the host being stopped...
authorEric Erhardt <eric.erhardt@microsoft.com>
Tue, 10 Aug 2021 15:18:28 +0000 (10:18 -0500)
committerGitHub <noreply@github.com>
Tue, 10 Aug 2021 15:18:28 +0000 (10:18 -0500)
commit4d26112c07391f563cb0ca46af1993635399007e
tree17e0d49856e61f07c2f0c2077cb961c72b50170b
parent78d5d1ca0cd375dbb553dd60d6e5f3435e4bd3e9
Don't log an error when a BackgroundService is canceled due to the host being stopped. (#57005)

* Don't log an error when a BackgroundService is canceled due to the host being stopped.

Fix #56032

* Add volatile to stopping field.

* Convert HostTests to use a logger instead of depending on EventSource.

* Make it obvious the test is using the default worker template
src/libraries/Microsoft.Extensions.Hosting/src/Internal/Host.cs
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostTests.cs
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/TestEventListener.cs [deleted file]
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/TestLoggerProvider.cs [new file with mode: 0644]