title: Call to unmanaged dll kills process without raising exception
body: <p>I have a WPF C# application targeting version 4.5 of the .Net framework. My application is calling an un-managed DLL, all but one method is working fine. When I call the problem method my process exits without raising any exceptions, the exit code is: <code>1073741855 (0x4000001f)</code></p>
  
  <p>I've read about the <a href="https://msdn.microsoft.com/en-us/library/dd638517(v=vs.110).aspx" rel="nofollow"><code>&lt;legacyCorruptedStateExceptionsPolicy&gt;</code></a> element and have added it to my app.config file. I've turned on ALL exceptions in the Exception Settings dialog (I'm using VS2015, BTW). At this point I've run out of techniques to determine what is causing the process to exit.</p>
  
  <p>Update: I happened to try turning on Enable native code debugging in the project settings and now receive the following exception:</p>
  
  <blockquote>
    <p>Exception thrown at 0x77CBED0B (ntdll.dll) in
    SK.UnmanagedDLLExceptionTest.exe: 0xC0000374: A heap has been
    corrupted (parameters: 0x77CF4270).</p>
  </blockquote>
  
  <p>Given the above information, do any of you know any other techniques that can be used to bring additional details to the surface?</p>
  
  <p>If you are interested (and willing) I have created a dead-simple console application that exhibits the problem, <a href="http://spireon.d.pr/AJ2J/1hVrEmpm" rel="nofollow">download here</a>.</p>