title: Why is Application.OnStartup not being called?
body: <p>I have a WPF .NET 4 application where I override the <code>OnStartup</code> method in order to process the file passed to my application. However, it seems that this method is not being called when the application runs. I put an exception in there and even a breakpoint and it starts up and completely ignores this.</p>
  
  <p>Am I missing something?</p>
  
  <p>Code for App.xml.cs:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Interaction logic for App.xaml
  /// &lt;/summary&gt;
  public partial class App : Application
  {
      protected override void OnStartup(StartupEventArgs e)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>Contents of App.xaml:</p>
  
  <pre><code>&lt;Application x:Class="XGN_Image_Downloader.App"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           StartupUri="MainWindow.xaml"&gt;
  &lt;Application.Resources&gt;
  
  &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong> Found it! The x:Class attribute in App.xaml did not match the App.xaml.cs class :) That's what you get for coding while drinking wine. (Thanks to this thread: <a href="https://stackoverflow.com/questions/2874920/wpf-app-startup-problems">WPF app startup problems</a>)</p>