diff --git a/src/libraries/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs b/src/libraries/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs index 50b747ecf1432f..4b493a5fc0d4eb 100644 --- a/src/libraries/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs +++ b/src/libraries/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs @@ -51,16 +51,9 @@ private void OnAccept(IAsyncResult result) { client = _socket.EndAccept(result); } - catch (SocketException e) + catch (SocketException) { - if (_disposed || - e.SocketErrorCode == SocketError.OperationAborted || - e.SocketErrorCode == SocketError.Interrupted) - { - return; - } - - throw; + return; } catch (ObjectDisposedException) { @@ -81,16 +74,8 @@ private void OnAccept(IAsyncResult result) { _socket.BeginAccept(OnAccept, null); } - catch (SocketException e) + catch (SocketException) { - if (_disposed || - e.SocketErrorCode == SocketError.OperationAborted || - e.SocketErrorCode == SocketError.Interrupted) - { - return; - } - - throw; } catch (ObjectDisposedException) {