File tree 2 files changed +10
-1
lines changed
src/Platform/Microsoft.Testing.Platform/Hosts
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,11 @@ public async Task<int> RunAsync()
69
69
await DisposeServiceProviderAsync ( ServiceProvider , isProcessShutdown : true ) ;
70
70
await DisposeHelper . DisposeAsync ( ServiceProvider . GetService < FileLoggerProvider > ( ) ) ;
71
71
await DisposeHelper . DisposeAsync ( PushOnlyProtocol ) ;
72
- await DisposeHelper . DisposeAsync ( ServiceProvider . GetTestApplicationCancellationTokenSource ( ) ) ;
72
+
73
+ // This is intentional that we are not disposing the CTS.
74
+ // An unobserved task exception could be raised after the dispose, and we want to use OutputDevice there
75
+ // which needs CTS down the path.
76
+ // await DisposeHelper.DisposeAsync(ServiceProvider.GetTestApplicationCancellationTokenSource());
73
77
}
74
78
75
79
if ( testApplicationCancellationToken . IsCancellationRequested )
Original file line number Diff line number Diff line change @@ -660,6 +660,11 @@ public void Dispose()
660
660
{
661
661
// Note: The lifetime of the _reader/_writer should be currently handled by the RunAsync()
662
662
// We could consider creating a stateful engine that has the lifetime == server connection UP.
663
+ if ( ! ServiceProvider . GetUnhandledExceptionsPolicy ( ) . FastFailOnFailure )
664
+ {
665
+ AppDomain . CurrentDomain . UnhandledException -= OnCurrentDomainUnhandledException ;
666
+ TaskScheduler . UnobservedTaskException -= OnTaskSchedulerUnobservedTaskException ;
667
+ }
663
668
}
664
669
665
670
internal async Task SendTestUpdateCompleteAsync ( Guid runId )
You can’t perform that action at this time.
0 commit comments