@@ -386,7 +386,7 @@ public async Task Can_Handle_Notify_Cancel()
386386 var token = TestContext . Current . CancellationToken ;
387387 TaskCompletionSource < JsonRpcNotification > clientReceived = new ( ) ;
388388 await using var client = await CreateMcpClientForServer (
389- options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , ( notification , cancellationToken ) =>
389+ options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , ( notification , _ ) =>
390390 {
391391 clientReceived . TrySetResult ( notification ) ;
392392 return clientReceived . Task ;
@@ -408,7 +408,6 @@ await NotifyClientAsync(
408408
409409 // Assert
410410 Assert . NotNull ( notification . Params ) ;
411- // Parse the Params string back to a CancelledNotification
412411 var cancelled = JsonSerializer . Deserialize < CancelledNotification > ( notification . Params . ToString ( ) ) ;
413412 Assert . NotNull ( cancelled ) ;
414413 Assert . Equal ( rpcNotification . RequestId . ToString ( ) , cancelled . RequestId . ToString ( ) ) ;
@@ -422,7 +421,7 @@ public async Task Should_Not_Intercept_Sent_Notifications()
422421 var token = TestContext . Current . CancellationToken ;
423422 TaskCompletionSource < JsonRpcNotification > clientReceived = new ( ) ;
424423 await using var client = await CreateMcpClientForServer (
425- options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , ( notification , cancellationToken ) =>
424+ options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , ( notification , _ ) =>
426425 {
427426 var exception = new InvalidOperationException ( "Should not intercept sent notifications" ) ;
428427 clientReceived . TrySetException ( exception ) ;
@@ -454,7 +453,7 @@ public async Task Can_Notify_Cancel()
454453 await using var client = await CreateMcpClientForServer (
455454 options : CreateClientOptions ( new Dictionary < string , Func < JsonRpcNotification , CancellationToken , Task > > ( )
456455 {
457- [ NotificationMethods . CancelledNotification ] = ( notification , cancellationToken ) =>
456+ [ NotificationMethods . CancelledNotification ] = ( notification , _ ) =>
458457 {
459458 InvalidOperationException exception = new ( "Should not intercept sent notifications" ) ;
460459 clientReceived . TrySetException ( exception ) ;
@@ -491,7 +490,7 @@ private static McpClientOptions CreateClientOptions(
491490
492491 private async Task NotifyClientAsync (
493492 string message , object ? parameters = null , CancellationToken token = default )
494- => await NotifyPipeAsync ( _serverToClientPipe , message , parameters , token ) ;
493+ => await NotifyPipeAsync ( _serverToClientPipe , message , parameters , token ) . ConfigureAwait ( false ) ;
495494 private async static Task NotifyPipeAsync (
496495 Pipe pipe , string message , object ? parameters = null , CancellationToken token = default )
497496 {
@@ -500,7 +499,7 @@ private async static Task NotifyPipeAsync(
500499 Method = message ,
501500 Params = parameters is not null ? JsonSerializer . Serialize ( parameters ) : null ,
502501 } ) ;
503- await pipe . Writer . WriteAsync ( bytes , token ) ;
504- await pipe . Writer . CompleteAsync ( ) ; // Signal the end of the message
502+ await pipe . Writer . WriteAsync ( bytes , token ) . ConfigureAwait ( false ) ;
503+ await pipe . Writer . CompleteAsync ( ) ;
505504 }
506505}
0 commit comments