How do I disable the dialog box I get when my application errors on exit? “Unknown software exception 0xc0020001”

StackOverflow https://stackoverflow.com/questions/9983344

Pregunta

I get an error on my unit test and it hangs my TeamCity continuous integration. How can I make it error headlessly? Fixing the error is a separate issue, please don't tell me that.

¿Fue útil?

Solución

The easiest solution is very likely to use SetErrorMode (with - at least - SEM_NOGPFAULTERRORBOX) to shut up any such error dialogs (see the flags in the MSDN docs) and silently have the process terminated.

Another option is to install your own top-level exception handler. In XP and newer you can use vectored exception handling. On any system including those newer ones you can use SetUnhandledExceptionFilter.

Part V, particularly chapter 25, of "Windows via C++" by Richter and Nasarre discusses the topic at great length and detail. The particular topic of WER and top-level exception handlers is also discussed in "Advanced Windows Debugging" (though from a different perspective).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top