I just had a problem hitting breakpoints in VS2015.

I am always using the solution configuration called Debug but for some reason my solution was set to build the Release version.

Switching from Release to Debug in the dropdown at the top of Visual Studio fixed my problem.

Answer from Helo on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › troubleshoot › developer › visualstudio › debuggers › troubleshooting-breakpoints
Troubleshoot breakpoints in the debugger - Visual Studio | Microsoft Learn
September 17, 2025 - Confirm that your code is running. To test that your code is running, add a call to System.Diagnostics.Debugger.Break (C#/VB) or __debugbreak (C++) to the line of code where you're trying to set the breakpoint and then rebuild your project.
Discussions

Breakpoint does not work during the test either with NUnit and MSTest. Visual Studio 2022, Net 6
Even reinstall visual studio didn't help. If you need more information about my configuration VS 2022 please let me know. ... A suite of integrated tools for creating, running, and managing tests to ensure code quality and reliability. ... Welcome to Microsoft Q&A! Do you have any error message or warning when the breakpoint doesn’t work? Are you debugging your test project in Debug or Release mode? If it is in Release mode, the breakpoints will not be hit... More on learn.microsoft.com
🌐 learn.microsoft.com
1
1
October 10, 2022
Breakpoints not being hit...tried the usual suspects, still not working.

This is going to sound dumb but the project MUST be in debug mode to hit breakpoints.

edit: Sorry, I did not see that you found a solution. I think older versions of VS allowed you to hit a breakpoint either way.

More on reddit.com
🌐 r/csharp
11
31
February 8, 2019
.net 7 xUnit Proj. Debugger Does Not Hit a Breakpoint in Visual Studio 2022
I guess a video capture with a minimal project (if you don't want to display your code) would help. Is your test project a library or a console application? More on reddit.com
🌐 r/dotnet
8
1
September 30, 2023
Debugging tests is not stopping on breakpoint
Type: Bug Behaviour Expected vs. Actual Expected: setting a breakpoint on a test and then debugging the test should trigger the breakpoint to enable step-by-step execution of the test. Actual: the ... More on github.com
🌐 github.com
25
January 13, 2023
🌐
Reddit
reddit.com › r/csharp › visual studio not hitting breakpoints or updating tests
r/csharp on Reddit: Visual studio not hitting breakpoints or updating tests
December 9, 2024 -

When i try debug tests and add a breakpoint at the first line, without any setup methods or anything prior, it runs the tests but wont hit breakpoints for some reason.

It also wont update the test, say I put a assert equals at the first line asserting that 1 = 0, it still goes to the previous error later in my test that shouldn't hit since the assert fails at the start

Is this a cache issue or a known bug?

SOLVED: my case was very niche where my database was in a perpetual restore state where we had a custom test runner which did stuff before any tests were run

However other solutions in the threads below are also very helpful for general help

🌐
Quora
quora.com › Why-is-Visual-Studio-not-hitting-the-breakpoint
Why is Visual Studio not hitting the breakpoint? - Quora
Answer (1 of 2): Please make sure you are running your project with Debug as solution configuration instead of release. it is an option on the top bar on visual studio.
Find elsewhere
🌐
Reddit
reddit.com › r/csharp › breakpoints not being hit...tried the usual suspects, still not working.
r/csharp on Reddit: Breakpoints not being hit...tried the usual suspects, still not working.
February 8, 2019 -

Hi all,

I've got a multi-project solution (VS 2017) (about 20 projects). We've made some changes, and I'm trying to run the tests again.

Initially, the breakpoint would become "hollow" and the test would start and then very quickly shut down. I managed in the second that the breakpoint icon was visible, to hover over it and see the standard message "Breakpoint will not currently be hit. The source code does not match....etc".

Tried cleaning, then rebuilding. Forced VS to load the symbols from MS, deleted the obj/bin folders etc... ...and still nothing worked.

So, I checked for an upgrade, installed it. Now I get the same behaviour, but without the hollow icon when the test attempts to run/debug.

I've checked that all projects are using the same DotNet framework, and there's no conflicts with third-party libraries etc... I've changed them to x86 from "Any CPU"...all to no avail.

I'm fresh out of ideas at this point. I've googled and tried everything found on StackExchange etc...but none of those solutions are working.

I still cannot run a test...or hit a breakpoint if I run the program directly. All the projects are set to Debug.

EDIT: Got it. For some reason XUnit was missing files (no idea how). Reinstalled using NuGet (and upgraded at the same time), and now my breakpoints (solution wide!) have started being hit.

🌐
Developers Log
developerslogblog.wordpress.com › 2017 › 09 › 07 › breakpoint-not-hit-in-visual-studio
Breakpoint not hit in Visual Studio – Developers Log
September 7, 2017 - Today was the turn of one of my colleagues to be temporarily baffled by another unexpected behavior in Visual Studio: he could not debug some of the functions in the code, the debugger was not stopping at the breakpoint.
🌐
Microsoft Support
support.microsoft.com › en-us › topic › fix-breakpoints-are-not-hit-when-you-debug-a-visual-studio-add-in-project-that-targets-the-net-framework-2-0-in-microsoft-visual-studio-2010-sp1-49b38b17-84d6-b23c-091d-4286879d26c8
FIX: Breakpoints are not hit when you debug a Visual Studio Add-in project that targets the .NET Framework 2.0 in Microsoft Visual Studio 2010 SP1 - Microsoft Support
This problem occurs because Visual Studio treats the add-in as a .NET Framework 2.0-based application. However, the Devenv.exe configuration files force the application to load as a .NET Framework 4.0-based application. Therefore, Visual Studio debugs the application in the wrong runtime, and this causes the breakpoints not to be hit.
🌐
Reddit
reddit.com › r/dotnet › .net 7 xunit proj. debugger does not hit a breakpoint in visual studio 2022
r/dotnet on Reddit: .net 7 xUnit Proj. Debugger Does Not Hit a Breakpoint in Visual Studio 2022
September 30, 2023 -

Spec: Win 10, Visual Studio Pro 2022 v17.7.4; .Net SDK v7.0.4

I have a solution with a bunch of different projects in it and one of them is a net7.0 xUnit Test proj. (converted from netstandard 2.0)

When I set a breakpoint to debug a test, it behaves like its just running a test instead of debugging it.

  1. Looks like the debugger gets launched, but the breakpoint doesn't get hit. Test produces a result (After building for debug -> .pdb file is in the bin -> Debug -> net7.0 dir so I assume all symbols loaded)

  2. I tried creating NUnit .net7.0 test -> same behavior.

  3. I tried creating xUnit .net48 test proj -> weirdly debugger works as expected.

  4. I tried putting Debug.WriteLine("In Debug!"). Debug output does not print the message.

  5. Updated xunit.runner.visualstudio to 2.5.1. Didn't help.

  6. Ran git clean -xdf on the repo, deleted all VS temp files, repaired VS through Installer, and reainstalled .net SDK (I wonder if, when I ran sdk installer, it might have detected that I already used the latest and hadn't actually reinstalled anything? but I doubt that's the problem) -> so all this didn't help.

--------

I left these for the end as these are solutions from other Stack Overflow posts that people ran into

7. I checked if the Debug Profile was missing; it wasn't. I created a new profile to make sure. Didn't help.

8. First, disabled all debugging settings in VS Tools -> Options -> Debugging -> General. Didn't help. Enabled all, didn't help.

9. Enabled/Disabled Hot Reload during debugging.

10. launchSettings.json is not in the projects.

11. In this [similar question](https://stackoverflow.com/questions/53827947/visual-studio-code-net-core-debugger-not-hitting-a-breakpoint) they recommend that I enable portable PDBs. Didn't help.

Thoughts: At this point I think its either some cached data thats interfering, or a .net bug. Debugger works as expected on a different computer (can't use different computer)

Throw your ideas at me. Thanks!

🌐
QA With Experts
qawithexperts.com › article › asp-net › solving-error-the-breakpoint-will-not-currently-be-hit-in-vi › 257
Solving error "the breakpoint will not currently be hit" in Visual studio ( Multiple ways) - QA With Experts
October 3, 2022 - OR First Close Visual Studio, Open Project again in Visual Studio -> Clean Solution, and then Rebuild Solution. Make sure, you have set the configuration to "Debug" mode and you are not working on "Release" mode while debugging your application.
🌐
GitHub
github.com › microsoft › debugpy › issues › 1175
Debugging tests is not stopping on breakpoint · Issue #1175 · microsoft/debugpy
January 13, 2023 - Actual: the test just runs through. The debugger panel appears at the top of the window but the debugger never stops execution of the code. Right-click on the green run button in the test file's gutter. Click "Add breakpoint".
Author   pcolmer
🌐
Developer Community
developercommunity.visualstudio.com › content › problem › 162058 › unit-test-breakpoint-not-hit-after-upgrading-to-vs.html
Unit Test breakpoint not hit after upgrading to VS2017 15.5
December 13, 2017 - Skip to main content · Microsoft · Visual Studio · Sign in · You need to enable JavaScript to run this app · Sorry this browser is no longer supported · Please use any other modern browser like 'Microsoft Edge'
Top answer
1 of 2
1

Thank you for reaching out!

 
You can try to start debugging your tests:

  1. Set Breakpoints: First, set breakpoints in the test methods that you want to debug. Since test methods can run in any order, make sure to set breakpoints in all the relevant test methods.
  2. Use Test Explorer:
    • Open Test Explorer in Visual Studio (you can find it under the Test menu > Windows > Test Explorer).
      • Select the test methods you want to debug.
        • Right-click on the selected tests in the pane and select Debug.

This should start a debugging session where you can step through your code and inspect the flow and values.

 
I'm unable to view the screenshot you attached. Could you please share it again, It will be help us to resolve the issue.

 

 

Let me know if you need any further help with this. I will be happy to assist. If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

2 of 2
0

If you are having trouble firing unit tests in debug mode in Visual Studio 2022, here are a few steps you can take to troubleshoot the issue:

  1. Set Breakpoints: Ensure that you have set breakpoints in your test methods. Since test methods can run in any order, it's important to set breakpoints in all the test methods you want to debug.
  2. Use Test Explorer: Open Test Explorer by navigating to Test > Windows > Test Explorer. From there, you can select the test methods you want to debug, right-click, and choose Debug.
  3. Check Configuration: Make sure that your project is configured correctly for debugging. Sometimes, issues can arise if the project settings are not set to debug mode.
  4. Rebuild the Project: If the tests are not showing up in Test Explorer, try rebuilding the project to refresh the test list.
  5. Check for Errors: Look for any errors in the Output window that may indicate issues with test discovery or execution. For instance, if you see a ReadOnlySpan error, it may be related to a known MSBuild issue that can be resolved by renaming certain files in the Visual Studio installation directory.
  6. Update Visual Studio: Ensure that you are using the latest version of Visual Studio 2022, as updates often include bug fixes and improvements that may resolve your issue.

If these steps do not resolve the issue, consider consulting the Visual Studio documentation or community forums for additional support.


References:

  • Debug and analyze unit tests by using Test Explorer
  • Unit testing JavaScript and TypeScript in Visual Studio