title: WPF Application crash at start-up
body: <p>I'm trying to start my application on another computer but when its starting it immediately crashes.</p>
  
  <p>My application doesn't try to read a file while its starting up, but it still crashes with a <code>System.IO.FileNotFoundException</code>.</p>
  
  <p>I have no idea what to do about it, can anyone lend me some help with this?</p>
  
  <p>This dumpfile was generated by with the application crash.</p>
  
  <pre><code>&lt;WERReportMetadata&gt;
  &lt;OSVersionInformation&gt;
      &lt;WindowsNTVersion&gt;6.1&lt;/WindowsNTVersion&gt;
      &lt;Build&gt;7600 &lt;/Build&gt;
      &lt;Product&gt;(0x3): Windows 7 Home Premium&lt;/Product&gt;
      &lt;Edition&gt;HomePremium&lt;/Edition&gt;
      &lt;BuildString&gt;7600.16917.amd64fre.win7_gdr.111118-2330&lt;/BuildString&gt;
      &lt;Revision&gt;1&lt;/Revision&gt;
      &lt;Flavor&gt;Multiprocessor Free&lt;/Flavor&gt;
      &lt;Architecture&gt;X64&lt;/Architecture&gt;
      &lt;LCID&gt;1043&lt;/LCID&gt;
  &lt;/OSVersionInformation&gt;
  &lt;ProblemSignatures&gt;
      &lt;EventType&gt;CLR20r3&lt;/EventType&gt;
      &lt;Parameter0&gt;bw000.exe&lt;/Parameter0&gt;
      &lt;Parameter1&gt;0.9.1.0&lt;/Parameter1&gt;
      &lt;Parameter2&gt;50461072&lt;/Parameter2&gt;
      &lt;Parameter3&gt;PresentationFramework&lt;/Parameter3&gt;
      &lt;Parameter4&gt;4.0.0.0&lt;/Parameter4&gt;
      &lt;Parameter5&gt;4d930fa2&lt;/Parameter5&gt;
      &lt;Parameter6&gt;9ef&lt;/Parameter6&gt;
      &lt;Parameter7&gt;f&lt;/Parameter7&gt;
      &lt;Parameter8&gt;System.IO.FileNotFoundException&lt;/Parameter8&gt;
  &lt;/ProblemSignatures&gt;
  &lt;DynamicSignatures&gt;
      &lt;Parameter1&gt;6.1.7600.2.0.0.768.3&lt;/Parameter1&gt;
      &lt;Parameter2&gt;1043&lt;/Parameter2&gt;
      &lt;Parameter22&gt;0a9e&lt;/Parameter22&gt;
      &lt;Parameter23&gt;0a9e372d3b4ad19135b953a78882e789&lt;/Parameter23&gt;
      &lt;Parameter24&gt;0a9e&lt;/Parameter24&gt;
      &lt;Parameter25&gt;0a9e372d3b4ad19135b953a78882e789&lt;/Parameter25&gt;
  &lt;/DynamicSignatures&gt;
  &lt;SystemInformation&gt;
      &lt;MID&gt;4F696B6F-82CF-4635-A6C8-BA2F7C68C6CA&lt;/MID&gt;
      &lt;SystemManufacturer&gt;MICRO-STAR INTERNATIONAL CO., LTD&lt;/SystemManufacturer&gt;
      &lt;SystemProductName&gt;MS-6657&lt;/SystemProductName&gt;
      &lt;BIOSVersion&gt;V1.30&lt;/BIOSVersion&gt;
  &lt;/SystemInformation&gt;
  </code></pre>
  
  <p></p>
  
  <p>I checked my file in the release folder and PresentationFramework.dll is there.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I tried installing .NET Framework 3.5, it didn't run. I think its because i have .NET 4 installed.</p>
  
  <p>I took the advice of Simon and looked in the Windows events log and found and stack trace of the error.</p>
  
  <p>This is the situation now:</p>
  
  <ul>
  <li><p>I have an 64-bit Windows 7 Home Premium to run the application on.</p></li>
  <li><p>The application is compiled as an 32-bit application.</p></li>
  <li><p>I have .Net 4 Extended and Client installed.</p></li>
  <li><p>I have set my main project and module project to run on .NET 4</p></li>
  <li><p>I have set an <code>DispatcherUnhandledException</code> but it isn't invoked, so it crashes before that.</p></li>
  </ul>
  
  <p>so can anyone help me with this ?</p>
  
  <p>This is the strack trace from the Windows Event logs:    </p>
  
  <pre><code>Log Name: Application
  Source:. NET Runtime
  Date: 13/09/2012 9:12:51
  Event ID: 1026
  Task Category: None
  Level: Error
  Keywords: Classic
  User: NA
  Computer: PC-freedom
  Description:
  Application: BW000.exe
  Framework Version: v4.0.30319
  Description: The process was terminated due to an unhandled exception.
  Exception Info: System.IO.FileNotFoundException
  Stack:
     at BW000.App.OnStartup (System.Windows.StartupEventArgs)
     ate System.Windows.Application. &lt;. ctor&gt; b__1 (System.Object)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall (System.Delegate, System.Object, Int32)
     at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen (System.Object, System.Delegate, System.Object, Int32, System.Delegate)
     at System.Windows.Threading.DispatcherOperation.InvokeImpl ()
     at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext (System.Object)
     at System.Threading.ExecutionContext.runTryCode (System.Object)
     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup (TryCode, Cleanup code, System.Object)
     at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Windows.Threading.DispatcherOperation.Invoke ()
     at System.Windows.Threading.Dispatcher.ProcessQueue ()
     at System.Windows.Threading.Dispatcher.WndProcHook (IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
     at MS.Win32.HwndWrapper.WndProc (IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation (System.Object)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall (System.Delegate, System.Object, Int32)
     at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen (System.Object, System.Delegate, System.Object, Int32, System.Delegate)
     at System.Windows.Threading.Dispatcher.InvokeImpl (System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
     at MS.Win32.HwndSubclass.SubclassWndProc (IntPtr, Int32, IntPtr, IntPtr)
     at MS.Win32.UnsafeNativeMethods.DispatchMessage (System.Windows.Interop.MSG ByRef)
     at System.Windows.Threading.Dispatcher.PushFrameImpl (System.Windows.Threading.DispatcherFrame)
     at System.Windows.Threading.Dispatcher.PushFrame (System.Windows.Threading.DispatcherFrame)
     at System.Windows.Threading.Dispatcher.Run ()
     at System.Windows.Application.RunDispatcher (System.Object)
     at System.Windows.Application.RunInternal (System.Windows.Window)
     at System.Windows.Application.Run (System.Windows.Window)
     at BW000.App.Main ()
      
  Event XML:
   &lt;event Xmlns="http://schemas.microsoft.com/win/2004/08/events/event"&gt;
     &lt;System&gt;
       &lt;Provider Name=".NET Runtime" /&gt;
       &lt;EventID Qualifiers="0"&gt; 1026 &lt;/ EventID&gt;
       &lt;level&gt; 2 &lt;/ Level&gt;
       &lt;Task&gt; 0 &lt;/ Task&gt;
       &lt;keywords&gt; 0x80000000000000 &lt;/ Keywords&gt;
       &lt;TimeCreated SystemTime="2012-09-13T07:12:51.000000000Z" /&gt;
       &lt;EventRecordID&gt; 525 &lt;/ EventRecordID&gt;
       &lt;channel&gt; Application &lt;/ Channel&gt;
       &lt;computer&gt; Freedom-PC &lt;/ Computer&gt;
       &lt;Security /&gt;
     &lt;/ System&gt;
     &lt;EventData&gt;
     &lt;Data&gt; Application: BW000.exe
  Framework Version: v4.0.30319
  Description: The process was terminated due to an unhandled exception.
  Exception Info: System.IO.FileNotFoundException
  Stack:
     at BW000.App.OnStartup (System.Windows.StartupEventArgs)
     ate System.Windows.Application. &lt;. ctor&gt; b__1 (System.Object)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall (System.Delegate, System.Object, Int32)
     at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen (System.Object, System.Delegate, System.Object, Int32, System.Delegate)
     at System.Windows.Threading.DispatcherOperation.InvokeImpl ()
     at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext (System.Object)
     at System.Threading.ExecutionContext.runTryCode (System.Object)
     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup (TryCode, Cleanup code, System.Object)
     at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Windows.Threading.DispatcherOperation.Invoke ()
     at System.Windows.Threading.Dispatcher.ProcessQueue ()
     at System.Windows.Threading.Dispatcher.WndProcHook (IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
     at MS.Win32.HwndWrapper.WndProc (IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation (System.Object)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall (System.Delegate, System.Object, Int32)
     at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen (System.Object, System.Delegate, System.Object, Int32, System.Delegate)
     at System.Windows.Threading.Dispatcher.InvokeImpl (System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
     at MS.Win32.HwndSubclass.SubclassWndProc (IntPtr, Int32, IntPtr, IntPtr)
     at MS.Win32.UnsafeNativeMethods.DispatchMessage (System.Windows.Interop.MSG ByRef)
     at System.Windows.Threading.Dispatcher.PushFrameImpl (System.Windows.Threading.DispatcherFrame)
     at System.Windows.Threading.Dispatcher.PushFrame (System.Windows.Threading.DispatcherFrame)
     at System.Windows.Threading.Dispatcher.Run ()
     at System.Windows.Application.RunDispatcher (System.Object)
     at System.Windows.Application.RunInternal (System.Windows.Window)
     at System.Windows.Application.Run (System.Windows.Window)
     at BW000.App.Main ()
  &lt;/ Data&gt;
    &lt;/ Event Data&gt;
  &lt;/ Event&gt;
  </code></pre>
  
  <p>Here some extra information that i found:</p>
  
  <pre><code>Log Name: Application
  Source: Application Error
  Date: 13/09/2012 9:12:52
  Event ID: 1000
  Task Category: (100)
  Level: Error
  Keywords: Classic
  User: NA
  Computer: PC-freedom
  Description:
  Name of application with error: BW000.exe, version: 0.1.0.0, time stamp: 0x504dfc8f
  Name of module with error: KERNELBASE.dll, version: 6.1.7601.17514, time stamp: 0x4ce7bafa
  Exception code: 0xe0434352
  Fault offset: 0x0000b727
  ID of process error: 0xf90
  Start time of application with error: 0x01cd917f300ba4e0
  Path to application with error: C: \ Users \ freedom \ AppData \ Roaming \ Boomerweb \ Boomerweb Platform \ App \ BW000.exe
  Path to module with error: C: \ Windows \ syswow64 \ KERNELBASE.dll
  Report Id: 6e2030c0-fd72-11e1-9968-406186e5690b
  Event XML:
  &lt;event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"&gt;
     &lt;System&gt;
       &lt;Provider Name="Application Error" /&gt;
       &lt;EventID Qualifiers="0"&gt; 1000 &lt;/ EventID&gt;
       &lt;level&gt; 2 &lt;/ Level&gt;
       &lt;Task&gt; 100 &lt;/ Task&gt;
       &lt;keywords&gt; 0x80000000000000 &lt;/ Keywords&gt;
       &lt;TimeCreated SystemTime="2012-09-13T07:12:52.000000000Z" /&gt;
       &lt;EventRecordID&gt; 526 &lt;/ EventRecordID&gt;
       &lt;channel&gt; Application &lt;/ Channel&gt;
       &lt;computer&gt; Freedom-PC &lt;/ Computer&gt;
       &lt;Security /&gt;
     &lt;/ System&gt;
     &lt;EventData&gt;
       &lt;Data&gt; BW000.exe &lt;/ Data&gt;
       &lt;Data&gt; 0.1.0.0 &lt;/ Data&gt;
       &lt;Data&gt; 504dfc8f &lt;/ Data&gt;
       &lt;Data&gt; KERNELBASE.dll &lt;/ Data&gt;
       &lt;Data&gt; 6.1.7601.17514 &lt;/ Data&gt;
       &lt;Data&gt; 4ce7bafa &lt;/ Data&gt;
       &lt;Data&gt; E0434352 &lt;/ Data&gt;
       &lt;Data&gt; 0000b727 &lt;/ Data&gt;
       &lt;Data&gt; F90 &lt;/ Data&gt;
       &lt;Data&gt; 01cd917f300ba4e0 &lt;/ Data&gt;
       &lt;Data&gt; C: \ Users \ freedom \ AppData \ Roaming \ Boomerweb \ Boomerweb Platform \ App \ BW000.exe &lt;/ Data&gt;
       &lt;Data&gt; C: \ Windows \ syswow64 \ KERNELBASE.dll &lt;/ Data&gt;
       &lt;Data&gt; 6e2030c0-fd72-11e1-9968-406186e5690b &lt;/ Data&gt;
     &lt;/ Event Data&gt;
  &lt;/ Event&gt;
  </code></pre>