@@ -421,7 +421,6 @@ public ResponseMessage ReceiveMessage(
421421 catch ( Exception ex )
422422 {
423423 helper . FailedReceivingMessage ( ex ) ;
424- ThrowOperationCanceledExceptionIfRequired ( ex ) ;
425424 throw ;
426425 }
427426 }
@@ -457,7 +456,6 @@ public async Task<ResponseMessage> ReceiveMessageAsync(
457456 catch ( Exception ex )
458457 {
459458 helper . FailedReceivingMessage ( ex ) ;
460- ThrowOperationCanceledExceptionIfRequired ( ex ) ;
461459 throw ;
462460 }
463461 }
@@ -540,7 +538,6 @@ public void SendMessage(OperationContext operationContext, RequestMessage messag
540538 catch ( Exception ex )
541539 {
542540 helper . FailedSendingMessage ( ex ) ;
543- ThrowOperationCanceledExceptionIfRequired ( ex ) ;
544541 throw ;
545542 }
546543 }
@@ -577,7 +574,6 @@ public async Task SendMessageAsync(OperationContext operationContext, RequestMes
577574 catch ( Exception ex )
578575 {
579576 helper . FailedSendingMessage ( ex ) ;
580- ThrowOperationCanceledExceptionIfRequired ( ex ) ;
581577 throw ;
582578 }
583579 }
@@ -687,19 +683,6 @@ ex is OperationCanceledException ||
687683 return new MongoConnectionException ( _connectionId , message , ex ) ;
688684 }
689685
690- private void ThrowOperationCanceledExceptionIfRequired ( Exception exception )
691- {
692- if ( exception is ObjectDisposedException objectDisposedException )
693- {
694- // We expect two cases here:
695- // objectDisposedException.ObjectName == GetType().Name
696- // objectDisposedException.Message == "The semaphore has been disposed."
697- // but since the last one is language-specific, the only option we have is avoiding any additional conditions for ObjectDisposedException
698- // TODO: this logic should be reviewed in the scope of https://jira.mongodb.org/browse/CSHARP-3165
699- throw new OperationCanceledException ( $ "The { nameof ( BinaryConnection ) } operation has been cancelled.", exception ) ;
700- }
701- }
702-
703686 // nested classes
704687 private class OpenConnectionHelper
705688 {
0 commit comments