title: WPF application crashes on window close
body: <p>I've been researching this problem for the last couple of weeks, nearly full time but to no avail. Our WPF application crashes on a window close rather than on startup or hanging after startup.</p>
  
  <p>The details:</p>
  
  <ul>
  <li>We have a .NET Framework 4 WPF application that runs on at least one computer but crashes on at least another two.</li>
  <li>At first we thought it was a problem in our WCF services or user's file/folder permissions. File/folder permissions were confirmed to be at least create-folder/new-file/edit-file/delete-file, which is sufficient for our purposes.</li>
  <li>The two computers where the application crashes have Windows 7 SP1. One has 32-bit and the other has 64-bit Windows.</li>
  <li>The computers run English Windows 7 with Chinese (Taiwan/Hong Kong) language packs so they must be the Ultimate or Enterprise editions.</li>
  <li>The computers in question are Toshiba laptops. The 32-bit one has i5-3320M 2.6GHz CPU, 4GB RAM, Intel HD Graphics 4000 and 2 monitors, including the laptop one.</li>
  <li>An empty WPF application (in VS: New Project > WPF Application > OK > Build) elicits very similar crashes to the full application when empty's main window is closed by clicking [X].</li>
  <li>A utility application, also WPF, which checks WCF service connections, runs service detection correctly but crashes on window close:</li>
  </ul>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/vV6H0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vV6H0.jpg" alt="UtilityAppCrash"></a><br>
  <sub>(source: <a href="http://www.kynetec.com/temp/UtilityAppCrash.jpg" rel="nofollow noreferrer">kynetec.com</a>)</sub>  </p>
  
  <p></p>
  
  <p>Here are copies of typical error reports (translated by Google to English), this also happens for all combinations of NET 4/4.5, VS 2010/2/3, anyCPU/x86 EXEs of the empty app:</p>
  
  <pre><code>Problem signature: 
  Problem Event Name: BEX 
  Application Name: EmptyWpfApp2010 (anyCPU NET4) exe. 
  Application Version: 1.0.0.0 
  Application time stamp: 531dc770 
  Error Module Name: StackHash_5949
  Error Module Version: 0.0.0.0
  Error module timestamp: 00000000 
  Exception Offset: 00620066 
  Exception Code: c0000005 
  Exception Information: 00000008 
  Operating System Version: 6.1.7601.2.1.0.256.48 
  Locale ID: 1028 
  Additional Information 1: 5949 
  Additional Information 2: 5949acb04a151ed1e962b41b4fd1d537 
  Additional Information 3: 0074 
  Additional Information 4: 00740617bbd2cb9521eb8c985e373025 
  </code></pre>
  
  <p></p>
  
  <pre><code>Problem signature:
  Problem Event Name: BEX 
  Application Name: EmptyWpfApp2013 (x86 NET4) exe. 
  Application Version: 1.0.0.0 
  Application time stamp: 531de903 
  Error Module Name: StackHash_5949
  Error Module Version: 0.0.0.0 
  Error module timestamp: 00000000 
  Exception Offset: 00640031 
  Exception Code: c0000005 
  Exception Information: 00000008 
  Operating System Version: 6.1.7601.2.1.0.256.48 
  Locale ID: 1028 
  Additional Information 1: 5949 
  Additional Information 2: 5949acb04a151ed1e962b41b4fd1d537 
  Additional Information 3: 0074 
  Additional Information 4: 00740617bbd2cb9521eb8c985e373025 
  </code></pre>
  
  <p></p>
  
  <p>I've tried:</p>
  
  <ul>
  <li>Reinstalling the .NET Framework 4. And applying updates.</li>
  <li>Reinstalling the application as Administrator.</li>
  <li>Running the application as Administrator.</li>
  <li>Running the application in "Windows XP SP3" compatibility mode for all users.</li>
  <li>Excluded the application's setup EXE from DEP and reinstalled, using the set of steps found at the end of this post: <a href="http://answers.microsoft.com/en-us/windows/forum/windows_7-gaming/cannot-disable-dep-for-certain-programs/d5352d1e-11ac-4254-ad3f-c0ecb85311f0" rel="nofollow noreferrer">http://answers.microsoft.com/en-us/windows/forum/windows_7-gaming/cannot-disable-dep-for-certain-programs/d5352d1e-11ac-4254-ad3f-c0ecb85311f0</a></li>
  <li>Kaspersky's TDSSKiller detected no threats.</li>
  <li>HiJackThis detected no threats as far as I can tell (log can be posted, if required).</li>
  <li>Installer for hotfix <a href="http://support.microsoft.com/kb/976038" rel="nofollow noreferrer">http://support.microsoft.com/kb/976038</a> does not apply.</li>
  <li>As far as I can tell "Toshiba Book Reader" is not installed.</li>
  <li>In the Registry, TrueType fonts don't have invalid path characters (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts).</li>
  <li>Updated Toshiba graphics driver does not help.
  <br/></li>
  </ul>
  
  <p>I'm at a loss. Any suggestions, please?</p>
  
  <p>
  </p>