Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Microsoft Visual C++ Runtime Error

If my application crashes, a Microsoft Visual C++ Runtime Library "Runtime Error!" occurs.

The text of the message is:
This applicaton has requested the Runtime to terminate in an unusual way.
Please contact the application's support team for more information.

I know, that I need to solve all these issues, but I imagine that this error did not appear in the past. Is there an option in Visual Studio 2005 to enable/disable such error (handling)?. Instead I expect the application to just crash/exit and offer an Microsoft Windows Error Report.

like image 511
kcode Avatar asked Dec 21 '09 07:12

kcode


2 Answers

This error message appears if an exception is not handled and unexpected() is called or if an exception escapes a destructor during stack unwinding and terminate() is called. Both lead to abort() being called and its abort() implementation that shows the message box. This behaviour is by design in VS2k3, VS2k5 and VS2k8. It is really annoying especially in applications meant to run without human intervention (like daily builds for example).

You can workaround this behaviour - use catch(...) to catch all exceptions at the top level and set your own terminate() handler using set_terminate().

like image 138
sharptooth Avatar answered Sep 18 '22 01:09

sharptooth


use:

_set_abort_behavior( 0, _WRITE_ABORT_MSG);
like image 34
aminM Avatar answered Sep 21 '22 01:09

aminM