@@ -59,12 +59,11 @@ public void Dispose()
59
59
{
60
60
debugService . Abort ( ) ;
61
61
_psesHost . StopAsync ( ) . GetAwaiter ( ) . GetResult ( ) ;
62
- GC . SuppressFinalize ( this ) ;
63
62
}
64
63
65
64
private void DebugService_DebuggerStopped ( object sender , DebuggerStoppedEventArgs e )
66
65
{
67
- _ = Task . Run ( ( ) => debuggerStoppedQueue . Add ( e ) ) ;
66
+ debuggerStoppedQueue . Add ( e ) ;
68
67
}
69
68
70
69
private ScriptFile GetDebugScript ( string fileName )
@@ -477,13 +476,14 @@ await debugService.SetLineBreakpointsAsync(
477
476
}
478
477
479
478
[ Trait ( "Category" , "DebugService" ) ]
480
- [ Fact ( Skip = "This test has a race condition." ) ]
479
+ [ Fact ]
481
480
public async Task DebuggerBreaksWhenRequested ( )
482
481
{
483
482
var confirmedBreakpoints = await GetConfirmedBreakpoints ( debugScriptFile ) . ConfigureAwait ( false ) ;
484
483
Assert . Equal ( 0 , confirmedBreakpoints . Count ) ;
485
484
Task _ = ExecuteDebugFile ( ) ;
486
- debugService . Break ( ) ;
485
+ // NOTE: This must be run on a separate thread so the async event handlers can fire.
486
+ await Task . Run ( ( ) => debugService . Break ( ) ) . ConfigureAwait ( false ) ;
487
487
AssertDebuggerPaused ( ) ;
488
488
}
489
489
@@ -492,7 +492,8 @@ public async Task DebuggerBreaksWhenRequested()
492
492
public async Task DebuggerRunsCommandsWhileStopped ( )
493
493
{
494
494
Task _ = ExecuteDebugFile ( ) ;
495
- debugService . Break ( ) ;
495
+ // NOTE: This must be run on a separate thread so the async event handlers can fire.
496
+ await Task . Run ( ( ) => debugService . Break ( ) ) . ConfigureAwait ( false ) ;
496
497
AssertDebuggerPaused ( ) ;
497
498
498
499
// Try running a command from outside the pipeline thread
0 commit comments