Since you are doing COM interoperability, I strongly suspect that some unmanaged code was running in a different thread, which caused an unhandled exception. This will cause the application to exit without accessing your raw exception handler. In addition, with .NET 4.0, the policy has become stronger when the application is closed without further notice. Under the following conditions, your application will be shut down without further notice (Environmnt.FailFast).
Pre.NET 4:
- Stackoververflowexception
.NET 4:
- Stackoververflowexception
- AccessViolationException
You can override the behavior in .NET 4 by decorating the method with HandleProcessCorruptedStateExceptionsAttribute or you can add legacyCorruptedStateExceptionsPolicy for your App.config.
If your problem is an uncovered exception in unmanaged code, you can either run the application under the debugger or allow it to crash and collect a memory dump for debugging post mortem. Crash dump debugging is usually done using WindDbg . After you download Windbg, you have adplus (a vbs script located in the Programm Files \ Debugging Tools for Windows section) that you can attach to the running process to trigger a crash dump when the process terminates due to an exception.
adplus -crash -p yourprocessid
Then you have a much better chance of knowing what happens when your process ends. Windows can also be configured to receive a crash dump for you through DrWatson on older versions of Windows (Windows Error Report)
Crash Dump Generation
Tough programmers insist on creating their own dump generation tool, which mainly uses the AEDebug registry key . When this key has a value that points to an existing executable, it is called when the application crashes, which can, for example, show the Visual Studio Debugger Chooser dialog or it can cause dump generation for your process.
Suspended Threads
It is often overlooked when you create an emergency dump with an external tool (it is better to rely on external tools, since you do not know how bad your process is damaged, and if it goes out of memory, you are already in a bad state of the situation) that you should suspend all threads from the crashed process before you take a dump. When you take a large full memory dump, it may take several minutes depending on the allocated memory of the failed process. During this time, application threads can continue to damage your application state, leaving you with a dump that contains the inconsistent state of the process that changed during the dump.
Alois Kraus Mar 13 2018-11-11T00: 00Z
source share