diff --git a/src/Renci.SshNet.Tests/Common/AsyncSocketListener.cs b/src/Renci.SshNet.Tests/Common/AsyncSocketListener.cs index 7900d26ba..5e9a38e36 100644 --- a/src/Renci.SshNet.Tests/Common/AsyncSocketListener.cs +++ b/src/Renci.SshNet.Tests/Common/AsyncSocketListener.cs @@ -323,13 +323,8 @@ void ConnectionDisconnected() } catch (ObjectDisposedException ex) { - //ConnectionDisconnected(); - if (!_started) - { - throw new Exception("BeginReceive throws ObjectDisposedException while stopping! " + _stackTrace, ex); - } - - throw new Exception("BeginReceive throws ObjectDisposedException while started! " + _stackTrace, ex); + // TODO On .NET 7, sometimes we get ObjectDisposedException when _started but only on appveyor, locally it works + ConnectionDisconnected(); } catch (SocketException ex) {