It is wild. I have not set a break point in the code, however it stopped at the line that was no break point. Let me demo this in a C# console application project.
When I clicked F5, it stopped at line 29. Clicking it again, then stopped at line 33....
The debug option is:
UPDATED
It could load an irrelevant symbol file. See below. How to disable it?
VS sometimes does not correctly remove its breakpoints. The solution is to use debug > remove all breakpoints.
Make sure you don't have a directory configured in the Cache symbols directory.
Go to Tools > Options > Debugging > Symbols.
If there is a directory that already set automaticly, shut down visual studio and delet it (or rename it if you wanna roll back from some reason).
It worked for me.
Dan.
Related
I have a .Net web project that I publish and then attach VS to w3wp.exe for debugging. I place breakpoints, load the specific web page being modified, and debug... over and over. This works fine for a while but then it just quits hitting the breakpoints and gives the error: "breakpoint cannot currently be hit, no symbols loaded.." with a hollow circle for the breakpoint. I cannot say what causes it to stop hitting the breakpoints. I'm just coding, publishing, debugging, repeating.... then I'm not. So, I do the following:
delete all debug and release folders,
delete the obj and bin folders
rebuild the solution
restart VS 2022
restart computer
update NuGet
make sure still configured for debug build
I did have some luck deleting all the files/folders in C:\Users\stever\AppData\Local\Temp\2 with today's date. In fact, I thought it WAS the fix because it fixed the issue a number of times and I was able to debug again. However, that stopped working too.
I did all the things mentioned a number of times and finally did get it to hit the breakpoints again. This has happened a lot! It sure would be nice to know what's causing this and what I need to do in order to debug again every time it happens. Any ideas for a fool-proof fix?
After a very long period of not getting this to work, I found something that works 100% for me. When I go to debug, I select "Attach to Process", then click the [Select] button for Attach To. I deselect "Automatically determine the type of code to debug" and manually select .Net 4x or .Net Core depending on what I'm debugging. Then I select the process and debug.
If it doesn't work, I stop the debugger, click [Select], and toggle "Native". Then I attach to the process again and it works every time!
So I'm trying to add some new code to a project I'm working on, but Visual studio is not cooperating at all.
The project is only hitting breakpoints on code that existed prior to this set of changes. See the screenshot below, where the top and bottom breakpoints are pre-existing code, and some new code is inside the if statement.
I have no idea where to start, I've tried a clean and rebuild, to no avail.
Solved:
Debug Menu -> Options -> Debugging -> General -> Uncheck Suppress JIT optimization on module load
I'm not sure why it decided to start acting up now(haven't had this problem for a year of work on this project), but I'm guessing the code I'm trying to debug was optimized away.
Do a Rebuild All. (I see you tried that--I listed for others to consider.)
Make sure all dependencies for the code in question are current. You might have a project reference to an assembly (DLL) that has since fallen out of sync with its PDB/source code. Be sure all references point to currently compiled code.
I've sometimes seen this happen and an exit/restart of Visual Studio (all instances, just to be safe) works.
If any of these ideas work, please let us know which one did.
I went through the same issue, tried everything above and the solution for me was to do: Debug > Delete all breakpoints to start fresh.
In my c#-project I use the HtmlAgilityPack. Everything worked fine for weeks, but today, when I run the code in Debug Mode and code related to the HtmlAgilityPack is used, VS keeps asking me for the location of "HtmlNode.cs" which is a class within the HtlmAgilityPack.dll. When I choose "Cancel", VS crashes.
I don´t even have any breakpoints set. I cleaned and rebuilt the solution, deleted obj and bin folders, renamed "HtmlAgilityPack.pdb", deleted the temp-folder in the %APPDATA%-directory and also deleted and re-set the link to the assembly. Nothing worked.
Does anybody know what to do?
I had a similar problem on VS C++ project. I deleted all the breakpoints and it worked for me: Debug -> Delete All Breakpoints (or use shortcut: Ctrl + Shift + F9).
I still have no solution on how to avoid VS trying to debug into the source file, but thanks to Ron, I figured out, that an exception in the source file was the cause for the problem and so I changed my code accordingly, so that any Exception would be avoided. (In may case, I tried to remove an Attribute in an HtmlNode which wasn´t there.)
To fix this issue you have to enable below under In Debug >> Options >> Debugging/General
(Show disassembly if source is not available) under Enable address-level debugging.
Possible exact duplicates:
Reason for VS.NET ‘current breakpoint will not be hit’ warning?
Why does Visual Studio sometimes not go to my breakpoints?
Why would the debugger not be stopping at a breakpoint in my ASP.NET application?
while debugging,the modified source code the break point is not hitted for a particular aspx page and the following error is shown in the break point
"the break point will not be currently hit.the source code is different from the original version"
but for other page it is working fine.
It worked for me. Try this.
First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)
If that didn't work check this:
1- Right mouse click your project
2- select [Properties]
3- select [Build] tab
4- make sure [Define DEBUG constant] and [Define TRACE constant] are checked
5- Click the [Advanced] button at the bottom of the Build tab page
6- Make sure that [Debug Info:] is set to [full]
7- Click [OK] and rebuild the project ;-)
Hope that works for you! (step 6 generates the .pdb files, these are the debugging symbols)
Some times this occurs if the sourcecode is been copied from the network folder, it messes up the symbol settings. Below solution works for me everytime
In debug mode, select debug->windows->modules
Check your dll symbolStatus . Make sure that it is loaded into
the project (i am sure now the status
is not loaded )
Right click your dll, click symbol settings.
And manually add your symbol path (.pdb file path)
And again right click the dll, and click load symbols
Hope this helps
That suggests the build that's running doesn't match with your code.
Try performing a "clean", make sure that you've stopped any previous debugger sessions etc, then rebuild and retry.
make sure there are not instances of w3wp.exe running. I had several and closing them fixed it for me.
Visual studio repair solved the problem for me
search for visual studio installer in start
select more option for the version you are using and click repair.
In my i changed the connection string but in the browser it was referring to old string so i just did 'empty cache and hard reload in chrome browser' and it worked
This problem occurred to me when I had copied the project. In fact, by opening the old code file if breakPoint is inserted, you will see that it will work. So learn the correct copying method.
I am having two issues with the debugger using visual studio version 9.0.30729.1 using .net 3.1
Issue one - I hit a breakpoint, and F10, F11 do not move me to the next instruction. If I repeatedly press F10 I will eventually step to the next instruction. I can place another breakpoint further down in the code and do an F5 to get to the next breakpoint - but I miss the ability to step.
Issue two - I hit my first breakpoint, do an F5 or F10 and the program continues without stopping.
These issues seem to occur semi randomly. Sometimes they clean themselves up if I shut down visual studio and reboot my computer - but not always. This does not occur as often in my unit tests as with the GUI application.
Any ideas will be appreciated.
Do you have a great deal of threads in the program? Could be Thread 1 breaks, you step, thread 2 breaks at the same point that thread 1 just broke at
Make sure the source code hasn't changed after you've started a debugger...
Just for giggles, try turning off just my code. Uncheck the "just my code ..." option under (Tools -> Options -> Debugger -> General)
JMC can cause odd behavior in scenarios you wouldn't necessarily expect.
Make sure your .pdb files are current, otherwise the source you're debugging and the source you're running might not match.
Try cleaning up your solution directory by deleting (renaming) all files generated by Visual Studio (*.ncb, *.suo, obj/, bin/, and maybe some more).