Async: How to break on exact line of code that has thrown the exception?

前端 未结 2 1583
星月不相逢
星月不相逢 2021-01-18 06:36

Say I have the following code:

async void buttonClick(object sender, RoutedEventArgs e)
{
    await nested1();
}

async Task nested1()
{
    await nested2();         


        
2条回答
  •  囚心锁ツ
    2021-01-18 07:32

    It's not possible.

    Why is it not possible?

    Because it's not done yet. async is still getting better tooling support with every release, and I do expect this behavior to be added sooner or later.

    How can I identify the line of code that has thrown the exception, whether that be a throw statement of my own code, or a framework method call that has thrown an exception?

    Visual Studio 2013 does have the ability to view asynchronous causality stacks in the debugger. If you want similar behavior at runtime, then you can use my async diagnostics package.

提交回复
热议问题