Search code examples
c++visual-studio-2010assert

How to track down Visual C++ assert


I'm running Visual Studio 10 and at runtime, my program is asserting the following error

Debug Assertion Failed! 
Program:
(filepath).exe
File: C:\Program Files(x86)\Microsoft Visual Studio 10.0\VC\include\algorithm
Line: 2910

Expression: sequence not ordered

I know that this means that I am misusing some function from the algorithm library, but the message gives me the line in the algorithm code, not in my code.

Is there a simple way to track down where I am misusing this function and which function it is? Stepping through my code is not an option because this issue only surfaces occasionally, and I haven't been able to identify when.

I've tried simply searching for all references to functions from the algorithm library, but this also doesn't help narrow down the possible causes very much.

I'm not providing code, because I'd like a general approach to hunting down errors, not a specific solution for my case.


Solution

  • Assertion code paths are active only in Debug builds and are caught by the debugger. Run your program in the debugger, let the assertion trigger and then walk the stack backtrace until you reach a line of code you wrote.