c# - vs2017 - the breakpoint will not currently be hit. the source code is different from the original version
How do I remedy the “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning? (20)
C# desktop application on express edition. Worked then didn't work 5 seconds later.
I tried the following.
- Ensure debug configuration, debug flag, and full debug info are set on all assemblies.
- Delete all bin and obj folders and all DLLs related to the project from my entire machine.
- Recreate projects causing the problem from scratch.
I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?
I want to add in 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.
Modules to see what modules were being loaded put me in the right direction.
In my case IIS Express seemed to be loading a different DLL from the temporary ASP.NET files.
- Browse to
C:\Users\<YOUR USER>\AppData\Local\Temp\Temporary ASP.NET Files\vs
- Delete everything in this directory!
Disable the "Just My Code" option in the Debug/General settings.
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
- 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)
I also had the same issue what I rebuild the whole solution (including refereced projects) in x86( or x64)
Even though I set all of my projects to x86 from Configuration Manager (Build->ConfigManager) some of my projects werent set to x86.
So Just to make sure right click on project->properties->Debug Tab, verify Configuration and Platform.
I have read carefully all the answers above, but none of them solved my problem.
In my case, I was compiling a class library (DLL). No modules seem to be loaded in Debug -> Modules, so I couldn't even load the symbols manually.
My solution was to add this line to my code:
Once this code is reached, an exception is triggered and .NET Framework shows a dialog box asking which Visual Studio (i.e. new instance of VS 2008, new instance of VS 2013, etc) you want to use to debug the program. You can choose the existing instance of VS with your project loaded. This will attach the process to your VS session and load all symbols, and now you can debug your project.
Of course, the compilation has to be done using the Debug configuration, not Release.
I tried everything mentioned above, but nothing worked. [Clean solution, and check for PDB files etc.]
Even publishing the same solution did not resolve the issue.
Then I went to back to what I usually do to resolve (fool this stubborn Visual Studio)
All I did was to make a deliberate change in code and publish the solution. Then I reverted the change and published again.
Voila [PDB files rid of evil spirits].. Not a smart resolution, but this did work.. :-|
I was able to fix the error by simply setting the option in the 'Attach to Process' to 'Automatically determine the type of code to debug' option as shown in the attached screenshot.
Simply follow the steps below:
- Go to Debug from the menu bar
- Click on Attach to Process
- Near the Attach to option, click on the Select button
- The Select Code Type window will appear
- Now select the option Automatically determine the type of code to debug and click the OK button.
In my case i am trying to debug in relase mode. Once i change it to debug mode. Its working
Just Check whether your solution is in Release Mode.
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.
Option "Start debugging, Debug + Windows + Modules" does not exist in Microsoft Visual Studio Express 2013 edition.
Unchecking "Use Managed Compatibility Mode" in Tools Options Debugging fixes this.
Project Properties (then select your build config) > Build Tab > Advanced... > Debug Info (dropdown)
Set to 'all' or 'pdb-only' then rebuild
Sometimes, even though it gives you this error, the
breakpoint still gets hit, so just ignore the error. This happens fairly often in the
Views of an
MVC web app.
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.
Things to check just to be clear: Make sure you have the configuration set to 'Debug' and not 'Release'. You can debug the startup project in 'Release' mode, but not a referenced class library.
This took me a while tried other options above and for some strange reason debugging stopped working.
Tool->Options->Debugging->General->(untick)"Require source files to exactly match the original version"
We found the cause of our problem. This code was using the "CodeBehind" attribute in the Page directive of the .aspx file instead of the "CodeFile" attribute (ASP.NET 2.0 and beyond). After days of desperation, a simple search and replace solved the problem.