SEHException thrown in a non-.NET application
I am writing an MFC application that doesn't use .NET (CLR support is set to No Common Language Runtime support in the project settings). However, I get an SEHException
thrown when I quit the application in Release build. Debug build gives me an assertion error, but the error window disa开发者_如何学Pythonppears in about half a second after it pops up (something I haven't encountered before either) so I don't get a chance to look at it.
So the main question is: how can an application that doesn't have any managed code throw an Interop.SEHException?
An application without managed code can throw a SEHException because structured exception handling (SEH) is part of Win32, and predates the CLR. Here's a link from January 1997 giving a crash course (hah!) on Win32 SEH.
Ah, fixed it. The problem was that I was calling my exiting code (that included a call to PostQuitMessage()
) twice from two separate threads. The disappearing box was due to the fact that very soon after the exception was thrown exit(0)
was called and the program terminated.
精彩评论