2
0
Эх сурвалжийг харах

Use ExceptionDispatchInfo to retain call stack in AsyncResult.EndInvoke() (#1470)

Scott Xu 1 жил өмнө
parent
commit
a067e2852a

+ 2 - 1
src/Renci.SshNet/Common/AsyncResult.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Runtime.ExceptionServices;
 using System.Threading;
 
 namespace Renci.SshNet.Common
@@ -85,7 +86,7 @@ namespace Renci.SshNet.Common
             // Operation is done: if an exception occurred, throw it
             if (_exception != null)
             {
-                throw _exception;
+                ExceptionDispatchInfo.Capture(_exception).Throw();
             }
         }