Getting a meaningful exception stacktrace in an async method

Arjan Vermunt's Avatar

Arjan Vermunt

17 Feb, 2017 07:00 AM


I've been using an aspect derived from OnExceptionAspect for quite some time now. When an exception is throw in an async method we get a rather cryptic stack trace. Is there a way to get a meaningful stack trace?

Kind regards,
Arjan Vermunt

  1. Support Staff 1 Posted by PostSharp Techn... on 19 Feb, 2017 08:34 PM

    PostSharp Technologies's Avatar


    this behavior is intrinsic for async methods as are state machines rather than normal methods. We do not currently have automatic solution.

    You would have to use ExceptionDispatchInfo in your OnExceptionAspect to get somewhat better understanding of the actual stack trace.

    Best regards,

  2. Support Staff 2 Posted by PostSharp Techn... on 28 Feb, 2017 02:42 PM

    PostSharp Technologies's Avatar


    We are going to close this request as we believe it was solved. Please feel free to reopen the discussion if you need more help.

    Best regards,
    PostSharp Team

  3. PostSharp Technologies closed this discussion on 28 Feb, 2017 02:42 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac