breakpoint will not currently be hit, why not?

Viewed 33012

Sometimes I get the message that the breakpoint will not be hit, and no symbols will be loaded.

The red icon in vs.net changes color, and the debug mode just doesn't work.

what is the reason for this?

13 Answers

You may be running your project in Release mode. If so, then switch to Debug mode

enter image description here

From Visual studio debugging issue with files of the same name by Philip Carney

Do each bullet in the link below ONE AT A TIME, but repeat my steps below with each one you try.

  1. Stop debugging (press red square icon) in Visual Studio

  2. Clean Solution

  3. Build Solution

  4. Tools > Attach to Process (or start with debugging)

  5. Start the program that you're attaching to, and run it such that your code will get hit

    • If attaching to nunit.exe, then open NUnit and run a test so your breakpoint will be hit

    • If attaching to w3wp.exe (IIS site), then open your site in the browser and go to the page that will hit your breakpoint

Next to the "Debug/Release" dropdown list, there is another one with "Any CPU/Configuration Manager...". Click "Configuration Manager...", and you will see some of your projects might be in Release mode. Change all of them to Debug.

I had the same problem. Which I know is normally if the build versions are different, and something isn't matching up. I cleaned my project, rebuilt it, and then deployed and that got everything back in-sync.

I have tested with both deployed application and service, what I have found out that If the deployed code is different than a code in visual studio then breakpoint will not hit. Even small changes will affect and the breakpoint will not hit. So, It is better to debug the same version which is there on vs code and also in deploy application or service.

To fix this I had to re-create the virtual directory. I'm using Asp.Net 4.7 Framework and IIS Express. Went to Web project > property page > Web tab > clicked the "Create Virtual Directory" button next to Project Url textbox.

enter image description here

I forgot I had clicked this button in my "Main" branch, but then had switched to my "Sprint" branch. It kept running the "Main" code until I clicked "Create Virtual Directory" on my "Sprint" branch.

Related