How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?
A C# desktop application on the express edition worked, but then it didn't work 5 seconds later.
I tried the following:
- Ensure debug configuration, debug flag, and full debug information are set on all assemblies.
- Delete all bin and obj folders and all DLL files related to the project from my entire machine.
- Recreate projects causing the problem from scratch.
I have two Windows Forms projects in the solution. One of them loads the debug information, one doesn't. They both refer to the assembly I'm trying to get debug information on in exactly the same way in the project file. Any ideas?
I want to add here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed. If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.
Start debugging, as soon as you've arrived at a breakpoint or used
Debug > Break All, use
Debug > Windows > Modules. You'll see a list of all the assemblies that are loaded into the process. Locate the one you want to get debug info for. Right-click it and select Symbol Load Information. You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly. Verify that list against the actual .pdb location. Make sure it doesn't find an old one.
In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe. The bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it.
Read more… Read less…
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:
- Right mouse click your project
- Select [Properties]
- Select the [Build] tab
- Make sure [Define DEBUG constant] and [Define TRACE constant] are checked
- Make sure [Optimize Code] is unchecked
- Click the [Advanced] button at the bottom of the Build tabpage
- Make sure that [Debug Info:] is set to [full]
- Click [OK] and rebuild the project ;-)
(step 6 generates the .pdb files, these are the debugging symbols)
Just something simple to try - you may have tried it already. Right click the Solution in solution explorer, click "clean solution", this deletes all the compiled and temporary files associated with a solution.
Do a rebuild of the solution and try to debug again.
I've also had troubles with breakpoints multiple projects in a solution - some compiled as x86, some as x64.
Disable the "Just My Code" option in the Debug/General settings.
The selected answer led me to fix my problem. But I need to do a few things more:
Even with "Debug" selected in the dropdown:
And in the project Properties > Build:
The Visual Studio was not loading symbols to a specific project. So in that dropdown I select "Configuration Manager" and saw that the settings to my web project was incorrect:
Then I set that to "Debug" and it started to generate the
BUT I need to manually copy the PDB and DLL and put in the folder that VS was looking (here is where the selected answer helped me):