Reputation: 103477
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?
Upvotes: 24
Views: 49047
Reputation: 13
In my case, I tried the solution below, and it worked.
Upvotes: 0
Reputation: 409
Upvotes: 5
Reputation: 724
For me it was giving this because I haven't started the relevant project at start of application , it worked after I added project run on start
Upvotes: 0
Reputation: 415
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.
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.
Upvotes: 0
Reputation: 18980
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.
Stop debugging (press red square icon) in Visual Studio
Clean Solution
Build Solution
Tools > Attach to Process (or start with debugging)
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
Upvotes: 8
Reputation: 107
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.
Upvotes: 0
Reputation: 3883
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.
Upvotes: 2
Reputation: 555
You may be running your project in Release mode. If so, then switch to Debug mode
Upvotes: 22
Reputation: 2831
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.
Upvotes: 1
Reputation: 475
I resolved this problem by selecting Automatic:Native Code for the "Attach to" field in "Attach To Process" form
Upvotes: 1
Reputation: 6555
After trying several suggested fixes for this I did the following to get it working.
Spent 3 1/2 hours on that... I'm going to go get a drink now.
Upvotes: 4
Reputation: 3723
I do not like to play with knives but the only thing that worked for me involved editing the .csproj file itself. So, unload the project file, edit it by cutting and pasting the three asp.net files so that they are together in the ItemGroup. However, sometimes it is necessary to go further as explained here: http://carnotaurus.tumblr.com/post/4130422114/visual-studio-debugging-issue-with-files-of-the-same - Also, I give a list of other proposed solutions that did not work for me. I hope it helps.
Upvotes: 0
Reputation: 2996
What does it say when you hover the mouse over the disabled breakpoint? It will usually tell you the problem. My favorite is the old 'source code is out of date', especially when I'm debugging a DLL. Another favorite is when the file you're looking at isn't the one you're debugging (a copy in another folder?). If it's a case where you can breakpoint a caller routine, but not the callee, stepping into the callee will force VS to open the 'proper' source file and you'll be able to set breakpoints. Confusing, I usually swear at VS at this point, it seems to help.
Upvotes: 2
Reputation: 9664
This can also happen if the debugger is not attached to the process for whatever reason. If it's the case, you can always go to Debug - Attach to Process... and choose the right process. Your breakpoints should return to normal once VS determines it can hit them.
Upvotes: 1
Reputation: 166326
This can happen if the symbol fiels are different from the assembly (remote debugging), or when there is no "direct path", so the assembly hasent been load, but might be loaded using reflection and loading of the required assembly at run time.
Upvotes: 1