File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/libraries/Microsoft.Extensions.Hosting/src/Internal Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,6 @@ public async Task StopAsync(CancellationToken cancellationToken = default)
7676 {
7777 foreach ( IHostedService hostedService in _hostedServices . Reverse ( ) )
7878 {
79- token . ThrowIfCancellationRequested ( ) ;
8079 try
8180 {
8281 await hostedService . StopAsync ( token ) . ConfigureAwait ( false ) ;
@@ -91,9 +90,14 @@ public async Task StopAsync(CancellationToken cancellationToken = default)
9190 // Fire IHostApplicationLifetime.Stopped
9291 _applicationLifetime . NotifyStopped ( ) ;
9392
94- token . ThrowIfCancellationRequested ( ) ;
95- await _hostLifetime . StopAsync ( token ) . ConfigureAwait ( false ) ;
96-
93+ try
94+ {
95+ await _hostLifetime . StopAsync ( token ) . ConfigureAwait ( false ) ;
96+ }
97+ catch ( Exception ex )
98+ {
99+ exceptions . Add ( ex ) ;
100+ }
97101
98102 if ( exceptions . Count > 0 )
99103 {
You can’t perform that action at this time.
0 commit comments