Visual Studio stops breaking on assert() - c++

This started happening today for a Visual Studio 2013 project but I have seen it now and then over the years in other Visual Studio versions.
Running a debug build and for some unknown reason aborts stop raising the message dialog that allows you to break and debug and instead you simple get a message in the output window and the program terminates.
R6010
- abort() has been called
The program '[9408] test_explode.exe' has exited with code 3 (0x3).
Over many years as a C++ developer this gremlin pops up now and then and I always forget how I solve it and can't see what the cause was. I'm sure someone can shed more light on what's happening and the correct fix and at a minimum I'll at least add my own notes.
A manual call to _set_error_mode(_OUT_TO_MSGBOX) somewhere in my program restores the correct behaviour. So it appears the default error mode is being set wrong by some compiler option or Visual Studio setting? I'm just not sure what.
All Debug->Exception settings are enabled.

Related

How do I debug an application crash (unhandled win32 exception) in vscode?

I have a running application that crashes with "An unhandled win32 exception occurred in ..." dialog. This only contains full-fledged Visual Studio in the available debuggers list even though Visual Studio Code is installed.
I would rather use vscode as it is my main dev environment.
How can I add it to the "Choose Just-In-Time Debugger" window's "Available Debuggers" list?
Update:
I found where the setting exists in the registry, with an example of how to set WinDbg as the debugger instead of Visual Studio.
https://www.codeproject.com/articles/6084/windows-debuggers-part-1-a-windbg-tutorial#_Toc64133667
and
https://learn.microsoft.com/en-us/windows/win32/debug/configuring-automatic-debugging
Remaining step is to determine how VS Code's debugger likes to be invoked.
(I'm still open to cleaner ways to do this, however.)
Update 2:
Nearest I can tell, this last step is the big deal breaker.
According to this feature request:
https://github.com/Microsoft/vscode/issues/10979
It doesn't look like the team at Microsoft is interested in making that an option. :_(

Visual Studio 2015 freezes when debugging a cpp code

I've installed Visual Studio 2015 Enterprise. I'm trying to create a c++ OpenGL project, however, it always freezes when I'm debugging(ctrl + f5). I've tried to write a simple program that prints text to the screen and it still freezes. The build completes successfully, projects in C# don't freeze as well. When I'm trying to run the cpp project VS freezes completely and I have to kill the process, running the .exe directly freezes the explorer..
I haven't found any solution to that kind of problem in the web, and I was hoping that someone here will know what to do..
Thanks :)
Try setting a breakpoint on the very first line of your main, click on debug and see if it gets to the breakpoint. If it does, try stepping through until you see what is causing your freeze.
I had exactly the same problem as you. Turns out my Avast anti-virus was causing the issue. I disabled it and now it's working.
I found the answer from this question:
Visual Studio 2015 freezes when finished building

Visual Studio 2013 debugging access issue with breakpoints

I've been having an issue with debugging my C++ programs recently in Visual Studio 2013. Normally my programs will run fine, however, when I include a breakpoint at the end of my code in order to keep the console open, I will have to manually stop the debugging of the program afterwards (Shift + F5), which will consistently cause an error saying "The debugger was unable to terminate one or more processes: [4912] .exe: Access is denied. The debugger may be unstable now. It is recommended that you save all files and exit." If I go on to continue coding and then compile again later, it will fail to compile with the error that access is denied with fatal error LNK1168, saying it cannot open the .exe for writing. This only happens when I include a breakpoint in my code, so I'm wondering if there's a fix for this, or something that I'm doing wrong? Thanks.

Visual c++ 2008 not showing runtime errors

I'm working on a project in Visual C++ 2008 Express and I have noticed that the program has stopped saying that there are run-time errors. Whenever I run the program, it just loads the latest stable build. It doesn't even show me the errors, because they disappear after launch. I want to know what is wrong with my code and fix it, but it just wouldn't show me the errors. It's my first program in Visual C++ and I have to do it until tomorrow. Please help!
EDIT: Solved, look in my comment

Visual Studio debug ghost cursor - program enters debug but cannot see current line nor variables

Strange situation when I am debuging a C++ application in Visual Studio.
I have set a breakpoint in my file and started debug, and run the scenario.
The application enters debug mode in visual studio at the set breakpoint, but:
I do not see the current line/cursor
there is no call stack displayed
there are no variables in Autos
in my Breakpoints list I see my breakpoint highlighted/bold (which means the debug is on the correct line)
Anyone ?
hope I have been somewhat clear...
Try the Visual Studio command "Debug.ShowNextStatement" (default Alt+Num*)
This can happen if the file you've loaded into the debugger isn't exactly the same version that was compiled.