How can I rethrow an Inner Exception while maintaining the stack trace generated so far?

后端 未结 8 2010
春和景丽
春和景丽 2021-01-31 05:03

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,

8条回答
  •  不要未来只要你来
    2021-01-31 05:45

    You can't do that. throw always resets the stack trace, unless used without parameter. I'm afraid your callers will have to use the InnerException...

提交回复
热议问题