Visual Studio crashes assertions without error message
I have a very similar problem to this post , but with a single threaded C ++ program: when an assertion fails while debugging in Visual Studio 2013, the debugger exits immediately without showing the assertion error message box, which should look something like this:
(This image is not from my own code.)
The only error message is:
The program '[5156] myprogram.exe' has exited with code 3 (0x3).
which makes it nearly impossible to figure out where the assertion failed because the code base is very large.
The answer to a related question suggested adding a call:
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
at the beginning of the program so that the assertion error is at least printed in the output window. However, this is not only a hack, but not necessary for any other program I have debugged in Visual Studio.
This is not my own Visual Studio project, and I wonder if there are outcasts out there somewhere. I have included "Break when an exception is thrown" for assertion errors in Debug -> Exceptions, so this is not a problem.
How can I force the "Commit Debug Error!" message box will appear when approval fails?
source to share
You can try setting custom invalid_parameter_handler.
I am facing similar issue when using vs2017.
the following code will not raise a debug confirmation error notification when I use my vs2017 for debugging.
char dst[128] = { 0 };
char src[256] = { 0 };
memcpy_s(dst, sizeof(dst), src, sizeof(src));
but when i installed custom handler. it works. Checkout this link
source to share