When Setting a Breakpoint in C Code "Break Mode" Pops Up

Bob Smith 0 Reputation points
2025-01-12T16:40:36.83+00:00

Running 17.12.3 (same problem with later versions) on my desktop under Win10 Pro (fully updated), when I set a breakpoint in my code (via the editor), "The Application is in Break Mode" pops up. In the past, the editor would show execution stopped at my breakpoint, at which I can start debugging.

When "Break Mode" pops up, it displays the text "Your app has entered a break state, but no code is currently executing that is supported by the selected debug engine (e.g. only native runtime code is executing)." I don't understand this.

When I click on Continue, the program continues, displaying the correct result. I just don't have the opportunity to stop at the breakpoint and debug.

In Exception Settings under Win32 Exceptions, if I check 0xE008000B, then when Break Mode pops up and I click on Continue, and extra dialog pops up "Exception Thrown" which says "Exception thrown at 0x767C0F22 (KernelBase.dll) in NARS2000.exe: 0xE008000B." Clicking on "Show Call Stack" displays an empty stack.

FWIW, I have unchecked "Enable Just My Code" in Tools>Debugging>General.

My application has no managed code and is written entirely in C. It is a GUI (actually an APL Interpreter) where I can type in 2+2 and it displays 4.

Up to recently, VS worked just fine. The only thing I can recall that changed is that I upgraded VS to the current Preview edition. During my attempt to debug the "Break Mode" problem, I backed down to a previous version of VS, but the problem didn't go away.

Now, I'm dead in the water. What am I missing?

BTW, on my laptop using VS 17.7.4, VS works as expected.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,339 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 55,841 Reputation points
    2025-01-12T22:50:58.76+00:00

    Are you compiling your code in debug mode? This tends to be the most common issue. Your code gets compiled with optimizations and your breakpoint is on code that was optimized away. At that point the debugger cannot map the breakpoint source back to your actual source code.

    Ensure that you are compiling your project in debug mode by confirming that the solution configuration is set to Debug. This is generally shown in the toolbar.

    enter image description here

    However this is the solution configuration and it is possible that a project is using a different configuration so you should also go to Configuration Manager (from Solution Explorer by right clicking the solution) for your solution and ensure your project is building for Debug as well in this configuration.

    enter image description here

    Ensure you are doing a full rebuild and that no errors occur. If you accidentally told VS to run projects even on build errors then it is possible you're running an older build of your code which can also cause problems.

    If the breakpoint works in the exe project but you're trying to set a breakpoint in a library project then it is possible the exe project is not using the built library project.

    If none of that works then a last resort is to close VS, wipe the .vs, bin and obj folders and then reopen and build your solution. This will reset everything including caches and breakpoints. Then try setting the breakpoint again.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.