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,

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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