title: Async: How to break on exact line of code that has thrown the exception?
body: <p>Say I have the following code:</p>
  
  <pre><code>async void buttonClick(object sender, RoutedEventArgs e)
  {
      await nested1();
  }
  
  async Task nested1()
  {
      await nested2();
  }
  
  async Task nested2()
  {
      await nested3();
  }
  
  async Task nested3()
  {
      await Task.Delay(1000);
      throw new Exception("Die");  // &lt;-- I want Visual Studio to break on this line
  }
  </code></pre>
  
  <p>How can I make Visual Studio break on the indicated line <strong>only when the exception is unhandled</strong>?</p>
  
  <hr>
  
  <p>Normally when the exception is thrown, Visual Studio will break here in App.g.i.cs:</p>
  
  <p><img src="https://i.stack.imgur.com/Gj76p.png" alt="enter image description here"></p>
  
  <p>If I then enable "Just my code" in the debugger options, it will break here instead:</p>
  
  <p><img src="https://i.stack.imgur.com/w8eWa.png" alt="enter image description here"></p>
  
  <p>Getting close. If I then check <code>System.Exception</code> under the "Thrown" column in the Exceptions window (Ctrl+Alt+E), it will break exactly where I want:</p>
  
  <p><img src="https://i.stack.imgur.com/2OuhF.png" alt="enter image description here"></p>
  
  <p><strong>but now Visual Studio will break on all thrown exceptions, not just unhandled ones</strong>. Is there any way to get Visual Studio to break at the most logical line of code only for unhandled exceptions, just like it would in regular non-async code? If this behavior is not possible, then:</p>
  
  <ul>
  <li>Why is it not possible?</li>
  <li>How can I identify the line of code that has thrown the exception, whether that be a <code>throw</code> statement <em>of my own code</em>, or a framework method call that has thrown an exception?</li>
  </ul>
  
  <p>I've used 3 nested functions here in this example to emphasize that my code may be complex with many branches and nested method calls, and identifying the problematic line of code is difficult if Visual Studio doesn't break on the innermost line of code.</p>