Skip to content

Commit

Permalink
Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandl…
Browse files Browse the repository at this point in the history
…e() (sshnet#936)

* Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandle()

* merge

* Update src/Renci.SshNet/Session.cs

Co-authored-by: Rob Hague <[email protected]>

---------

Co-authored-by: Wojciech Nagórski <[email protected]>
Co-authored-by: Rob Hague <[email protected]>
  • Loading branch information
3 people authored Sep 15, 2023
1 parent 60de8a4 commit dcc596a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Renci.SshNet/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit dcc596a

Please sign in to comment.