Say I have the following code:
async void buttonClick(object sender, RoutedEventArgs e)
{
await nested1();
}
async Task nested1()
{
await nested2();
I think I may have discovered the answer to my question.
First, I uncheck System.Exception
under the "Thrown" column in the exceptions window (Ctrl+Alt+E). I do this because I don't want Visual Studio to break on all exceptions, only unhandled ones.
Second, I keep "Just my code" enabled in the debugger options.
Now, when the debugger breaks, it will break here:
as per the screenshot in my question. But if I inspect the call stack:
I can actually see where the exception originated from (in nested3()
, line 46). If I click this entry in the call stack window, Visual Studio will jump to the correct line, and the "Locals" window will even show me the values of local variables in that frame. Cool! I think this is what I wanted.