We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0592b81 commit 0dda9bdCopy full SHA for 0dda9bd
CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs
@@ -1657,7 +1657,12 @@ public object Evaluate(string expression)
1657
}
1658
catch (TargetInvocationException exception) when (exception.InnerException != null)
1659
{
1660
- ExceptionDispatchInfo.Capture(exception.InnerException).Throw();
+ Exception exceptionToThrow = exception.InnerException;
1661
+
1662
+ while (exceptionToThrow is TargetInvocationException && exceptionToThrow.InnerException != null)
1663
+ exceptionToThrow = exceptionToThrow.InnerException;
1664
1665
+ ExceptionDispatchInfo.Capture(exceptionToThrow).Throw();
1666
// Will not go here but need to return something to avoid compilation errors.
1667
return null;
1668
0 commit comments