Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio - Assert not stopping when fails

Just moved from VS2010 Professional to Premium.

When I hit a failing Assert using MSTEST, it doesn't stop in the debugger anymore (it does produce a correct fail in the Test Results)

Problem: How to get the debugger to stop on the failing assert when I run tests

enter image description here

like image 602
Dave Mateer Avatar asked Feb 03 '11 21:02

Dave Mateer


People also ask

What happens if an assert is failed?

An assertion failure occurs when the database server cannot continue normal processing and must shut down. You can correct some of the problems that cause assertion failures, such as disk issues. For other problems that cause assertion failures, you must contact IBM® Software Support.

How do you debug assertion failure?

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.

What happens if an assert is failed C++?

An assertion statement specifies a condition that you expect to be true at a point in your program. If that condition is not true, the assertion fails, execution of your program is interrupted, and the Assertion Failed dialog box appears.


2 Answers

In order to do this you'll need to do the following

  • Disable Just My Code: Tools -> Options -> Debugger. Uncheck "Enable Just My Code"
  • Enable Break on throw: Debug -> Exceptions. Check "thrown" for CLR exceptions.
like image 115
JaredPar Avatar answered Oct 17 '22 06:10

JaredPar


I've seen this before when I run failed tests with (CTRL + R, F) which just runs the failed tests where (CTRL + R, CTRL + F) debugs the tests and breaks when the assert fails. Let me know if this helps.

like image 21
khr055 Avatar answered Oct 17 '22 07:10

khr055