How can I rethrow an Inner Exception while maintaining the stack trace generated so far?
问题 Duplicate of: In C#, how can I rethrow InnerException without losing stack trace? I have some operations that I invoke asynchronously on a background thread. Sometimes, things go bad. When this happens, I tend to get a TargetInvocationException, which, while appropriate, is quite useless. What I really need is the TargetInvocationException's InnerException, like this: try { ReturnValue = myFunctionCall.Invoke(Target, Parameters); } catch (TargetInvocationException err) { throw err