diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index 9fec6bd7e..257cf8c2c 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -992,7 +992,8 @@ internal void WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout) switch (signaledElement) { case 0: - throw _exception; + System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(_exception).Throw(); + break; case 1: throw new SshConnectionException("Client not connected."); case 2: