How to stop at the first assert failed in Visual Studio?
When I debug, for each assert that fails I get pop-up windows one on top of the other. But I don't want that behaviour, I need the program to stop at the first failed assert, so that I can debug from there.
Thanks
In Visual Studio, go to Debug / Windows / Exception Settings. In the Exception Settings, go to Win32 Exceptions / 0xc0000420 Assertion Failed. Uncheck the box in front of that entry.
If an assertion fails, the assert() macro arranges to print a diagnostic message describing the condition that should have been true but was not, and then it kills the program. In C, using assert() looks this: #include <assert. h> int myfunc(int a, double b) { assert(a <= 5 && b >= 17.1); … }
If that condition does not hold true, the assertion fails, execution of your program is interrupted, and this dialog box appears. Debug the assertion or get help on asserts. Ignore the assertion and continue running the program. Halt execution of the program and end the debugging session.
VS 2015: Menu->Debug->Windows->Exception Settings
Pre-VS 2015: Debug > Exceptions, expand Win32 Exceptions, and check Assert Failed:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With