title: Debugger gets stuck in WPF OnStartup method
body: <p>I am experiencing a problem in my project where if I get an exception in OnStartup code in App.xaml.cs debugger will breakpoint first and when I click continue it will run and breakpoint at the same location rather than exiting app.</p>
  
  <p>However if I add DispatcherUnhandledException event handler in App.xaml.cs and <strong>empty</strong> event handler it will work as expected.</p>
  
  <pre><code>&lt;Application x:Class="WpfApplication8.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               DispatcherUnhandledException="App_DispatcherUnhandledException"
               StartupUri="MainWindow.xaml"&gt;
      &lt;Application.Resources /&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>App.Xaml.cs</p>
  
  <pre><code>public partial class App : Application
  {
      protected override void OnStartup(StartupEventArgs e)
      {
          base.OnStartup(e);
          var b = 4 - 4;
          var a = 100/b;
      }
  
      void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs args)
      {
  
      } 
  }
  </code></pre>
  
  <p>To reproduce issue remove event handler from code behind.</p>
  
  <p>Solution details: WPF, .Net 4 (with all current updates), Visual Studio 20013 update 3.</p>
  
  <p>Could anyone explain why do I get this behaviour?</p>