File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2444,13 +2444,15 @@ public void Dispose()
24442444 /// </summary>
24452445 /// <returns>A <see cref="ValueTask"/> representing the asynchronous dispose operation.</returns>
24462446 /// <remarks>
2447- /// This method calls <see cref="ForceStopAsync"/> to immediately release all resources.
2447+ /// This method calls <see cref="StopAsync"/> to gracefully shut down the runtime and
2448+ /// release all resources. Use <see cref="ForceStopAsync"/> for an immediate hard stop
2449+ /// that skips graceful runtime shutdown.
24482450 /// </remarks>
24492451 public async ValueTask DisposeAsync ( )
24502452 {
24512453 if ( _disposed ) return ;
24522454 _disposed = true ;
2453- await ForceStopAsync ( ) ;
2455+ await StopAsync ( ) ;
24542456 }
24552457
24562458 private class RpcHandler ( CopilotClient client )
Original file line number Diff line number Diff line change @@ -32,6 +32,20 @@ public async Task StopAsync_Requests_Runtime_Shutdown_For_Owned_Process()
3232 Assert . Equal ( 1 , server . RuntimeShutdownCount ) ;
3333 }
3434
35+ [ Fact ]
36+ public async Task DisposeAsync_Requests_Runtime_Shutdown_For_Owned_Process ( )
37+ {
38+ await using var server = await FakeCopilotServer . StartAsync ( ) ;
39+ var client = new CopilotClient ( new CopilotClientOptions { Connection = RuntimeConnection . ForUri ( server . Url ) } ) ;
40+ await client . StartAsync ( ) ;
41+ using var process = StartExitedProcess ( ) ;
42+ await ReplaceConnectionCliProcessAsync ( client , process ) ;
43+
44+ await client . DisposeAsync ( ) ;
45+
46+ Assert . Equal ( 1 , server . RuntimeShutdownCount ) ;
47+ }
48+
3549 [ Fact ]
3650 public async Task StopAsync_Does_Not_Throw_When_Runtime_Shutdown_Fails ( )
3751 {
You can’t perform that action at this time.
0 commit comments