Skip to content

Commit a067e28

Browse files
authored
Use ExceptionDispatchInfo to retain call stack in AsyncResult.EndInvoke() (#1470)
1 parent fe65570 commit a067e28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Renci.SshNet/Common/AsyncResult.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Runtime.ExceptionServices;
23
using System.Threading;
34

45
namespace Renci.SshNet.Common
@@ -85,7 +86,7 @@ internal void EndInvoke()
8586
// Operation is done: if an exception occurred, throw it
8687
if (_exception != null)
8788
{
88-
throw _exception;
89+
ExceptionDispatchInfo.Capture(_exception).Throw();
8990
}
9091
}
9192

0 commit comments

Comments
 (0)