Working on an ASP.NET C# web application project in Visual Studio 2022. I've been having the infamous "Breakpoint will not currently be hit. No symbols have been loaded for this document" error when trying to debug.
I've poured over questions here looking for solutions. I am definitely running the debug configuration, and just found out that, in the Module window, absolutely nothing had loaded.
I found a solution for getting some to load by switching the browser I was debugging in (Google Chrome -> Edge). But, now that I have modules in the window, most have "Cannot find or open the PDB file" under the "Symbol Status" column, and my breakpoints are still encountering the same error.
I have been at this for a day or two now with no solutions. I'm not sure where to go from here. Any advice, solutions?
Diagnosed that no symbols had loaded for my project, and expected breakpoints to start working once they had. Symbols have still not loaded properly and breakpoints are still broken.
Related
I've looked through the answers to about 5 similar questions, and particularly the top page of answers to this 1.5k upvoted question, but none of the fixes in there do anything for me.
I've inherited a C# project and am trying to debug it. I'm a bit new at C#, but have more than a decade experience with Visual C++. So I know my way around the debugger a bit at least, and have had to deal with debugging DLL's before. However, this one has me stumped.
I can set breakpoints in the main project's .cs files and they work just fine, but when I try to set one in a sub-project dll ("assembly"?) all the breakpoints show up at runtime with "The breakpoint will not currently be hit. No symbols have been loaded for this document."
What I've tried:
Clean and rebuild.
Clean, delete all copies of the dll and pdb from my hard drive, rebuild.
Verified the project props are set to Define DEBUG constant, Define TRACE constant.
Set the subproject (assembly) as the startup project, with the main exe (in the same directory as the DLL and PDB) as the Start external program
In the project build settings, Debug Info is set to full, and Optimize code is not set.
The debug option Enable Just My Code is not checked (I checked it, there's no checkmark in the box).
I'm not trying to build or debug in a Release configuration.
I've also checked the loaded DLL in process explorer and the Symbol Load Information in the debugger, and they match:
Process Explorer:
VS 2012's Symbol Load Information:
So its clearly got some PDB loaded, its in the same directory as the DLL, and they both get built when I build the project. The timestamp on the two files is identical. Yet VS'debugger doesn't think symbols are loaded for that file.
I am working on an ASP.NET project and getting the dreaded The breakpoint will not currently be hit. No code has been loaded for this code location.
I am running in debug configuration, and other projects in the same solution can be debugged properly.
I'm using Visual Studio 2017 Community edition, in the modules window I see an empty list, I have to right click and select Show Modules for all Processes to get anything to appear, and when it appears it does not show the name of the .dll, it shows the name of the .aspx page that the launched browser is currently sitting on, which will update as I navigate around the site.
From all the answers I have found online, it should be showing the name of my project's .dll file, such as MyProject.dll, then you can manually load the symbols from there by looking in the bin directory for MyProject.pdb (which does exist), but I am seeing the page name, Register.aspx, which of course will not work if I try to load the symbols for MyProject.pdb.
Or maybe I'm totally off-base here, I'm happy to provide any info that might help!
first of all, this is a repetitive question. but things are not same in my case. I have tried most of the solutions. but nothing changed. so, here is the problem,
I have standalone sdk for a fingerprint device and working with visual studio 2015 windows form application. When I tried to debug, I got this message, "The breakpoint will not currently be hit, No symbols have been loaded for this document".
I tried: Build --> Windows --> Modules to load symbol. but they referred a symbol of one of the dll file (Interop.zkemkeeper.pdb). which I didn't find there instead I found a .pdb file as my project name (AttLogs.pdb). (I know its not logical though) I tried to choose the AttLogs.pdb. and then I got a message saying, "A matching symbol was not found in this folder". So,
1. How do I make my code debug-able? or
2. How do I create a Interop.zkemkeeper.pdb file?
please suggest me anything related or helpfull. I got stuck here for about a week.
I created 2 instances of same project to apply different changes. So when I open project1 and debug class1, everything is smooth, I can have my breakpoints hit all other debugging features.
When I open project2 and close project1, I try to do same debugging on class1(some lines of the code is different), I get warning that
"the breakpoint will currently not hit. a copy of class1.cs was found in project1.dal.dll, but the current source code is the different from ther version"
When I close the VS completely and reopen the projects or If I clear the Temporary ASP.NET Files, Problem is getting resolved. But it happens everytime for me. so my questions are;
1) I wonder why does it happen and how can I resolve it without closing VS or clearing cache files?
2) I know the option called "Uncheck Require source files to exactly match the original version".. Is it safe to do it? or is there any side affects or disadvantages
It is impossible to debug your code in that way - you are creating different symbols for each build so when you debug one version, the other is not compatible with the previous one.
To make the long story short - you cannot debug one version of code when symbols from another version are loaded.
More info: Fixing "The breakpoint will not currently be hit. No symbols have been loaded for this document."
EDIT:
Check this link also: What is the "Temporary ASP.NET Files" folder for?
I'm having an issue with loading symbols on my ASP.NET MVC project. The first time I load visual studio and debug my project, symbols are loaded in roughly 2 seconds. I then end the debug session, make a code modification, and debug again, and the symbol load time is about a minute. Based on the research I have done, here are some applicable settings on my machine/VS:
In Options/Debugging/Symbols/Symbol file locations, "Microsoft Symbol Servers" is unchecked, and there are no additional locations.
Options/Debugging/Symbols/Cache symbols in this directory is "G:\Symbol Cache". I did click "Load all symbols" and I have inspected that directory and I see lots of symbols.
Just my code is enabled.
The _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH environment variables are not defined on my machine.
Options/Debugging/Symbols/Automatically load symbols for is set to "Only specified modules", with no modules specified.
I have tried both debug and release builds, with identical results. Ctrl + F5 loads the site almost immediately.
I too had this problem, the cause was that I had accidently enabled the "Microsoft Symbol Server"
You can disable it by going to Tools > Options > Debugging > Symbols and uncheck the "Microsoft Symbol Server"
Now it loads just as fast as it used to.
I too had this problem and noticed that it was mostly related to 3rd-party assemblies acquired via NuGet. In these cases, Visual Studio was trying to load PDBs from paths that apparently existed on the original author's machine (i.e. D:\OriginalAuthor\MyVisualStudioProjects\AwesomeNuGetPackage) but on my machine the same path referred to an optical drive. I then discovered via Command Prompt that if you tried to change directory to an optical drive that didn't have a disc in the tray, it took a very long time (~30 seconds) to fail. With this in mind, my solution was to simply place a DVD in the tray. At that point Visual Studio was able to very quickly determine that the path didn't exist, skip loading the PDB, and go straight into debug.
So, if Visual Studio is taking a long time to load symbols, watch the Output window for the paths it's trying to access and verify that you can quickly access (or quickly fail to access) those paths yourself via Command Prompt.
This brings up an interesting question about security/privacy--apparently Visual Studio is storing the absolute path of the original PBD within the assembly. I suppose this isn't a super critical issue, but from a privacy perspective I don't really want my absolute filesystem paths being exposed to the public without my knowledge.
Just try this Debug -> Delete All Breakpoints.
Its works on me.
I had 2 .dll's giving me grief that I didn't need to debug that started taking minutes to load. The afore mentioned solutions didn't help. So I went to Options -> Debugging -> Symbols and under the radio button for "All modules, unless excluded" click on "Specify excluded modules" link. Then type the .dll's that are causing issues.