How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?
Solution 1
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, i.e. the bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it.
Solution 2
Check if you are not in release but in Debug.
When in debug:
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 7 generates the .pdb files, these are the debugging symbols)
Solution 3
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.
Solution 4
Disable the "Just My Code" option in the Debug/General settings.
Solution 5
Cross posting this fix from Hans K that I found on the similar thread >> HERE <<:
Right click on solution --> Properties
Look under Common Properties --> Startup Project
Select multiple startup projects
select Start action on the projects you need to debug.
Instance Hunter
Updated on April 25, 2022Comments
-
Instance Hunter about 2 years
A C# desktop application (on the Visual Studio Express/Community 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.
- Reboot.
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.
-
Vasyl Boroviak over 14 yearsMade them both load debug info. And try to unload one of the projects you do not run at the moment.
-
Polyfun over 14 yearsWhen debugging, goto to the Debug, Windows, Modules view. This will show info about loaded modules and symbol status. You can right click a module and try to load the symbols from another location.
-
Instance Hunter over 14 yearsExpress edition does not have Modules view.
-
Tim Coker over 12 yearsGood point about assemblies not loaded until needed. The debugger will show that the breakpoint won't be hit, but the display will change/your breakpoint WILL be hit once the assembly is loaded. A cheesy workaround this UI issue would be to make a call to the assembly at program start to force the assembly to be loaded.
-
Muhammad Azeem over 11 yearsI have Multiple Project in a solution. Some of them are Class Libraries.. am using there refrencnes in other Solution and projects.. During Debbuging: I found that its not going there i put breakpoint but showing a messege that is also follwing your steps
-
Bhaumik Patel over 11 yearsI also faced such error and try many solutions but below solution works for me best : its due to different framework version when you try to attach process. For more details, please visit: stackoverflow.com/a/13106908/1218422
-
Hot Licks over 10 yearsWell, I have this symptom on VS 2012, pretty much out of the box, running on Windows 7. Tried maybe 8 of the "fixes" below -- nothing worked. I'm just running a simple sample program.
-
Prageeth godage about 9 yearsDid do all step except deleting the C:\Windows\Temp file and after deleting it works fine. ....... :D
-
Anders Finn Jørgensen over 8 yearsI fixed the problem by made a minor change in the source code (a line shift) to force it to rebuild, and the problem disappeared.
-
live-love over 8 yearsMake sure all your projects are loaded in your solution. I had one that wasn't and that's what was causing the problem.
-
kuskmen over 7 yearsI had same issue and I noticed that for this build configuration I didn't have
<DebugSymbols>true</DebugSymbols>
under it in VS2015 I manually added it and it worked fine. -
Roland almost 7 yearsRemoving the .suo file might have solved this ugly problem at my project
-
Marc.2377 over 5 yearsRelated: stackoverflow.com/q/31732944/3258851
-
Alex about 4 yearsThanks for the recent edit. I had the exact same issue. My dll-breakpoint complained that it didn't have any debug info until I opened the form that loaded the dll.
-
tfa about 4 yearsHad to restart my PC not restart VS but restart my PC and debugging came back working
-
Rehmanali Momin about 4 yearsThe first thing to check would be that the Solution Configuration on the top bar should be in Debug mode.
-
Alexandru over 3 yearsCheck the source file you're editing. For example, if its
Program.cs
, hover over the title to see the full path. Its possible you moved your solution but your workspace still points to the file you have in the old location! -
Kris over 2 yearsI had the same problem when publishing the app as "self contained"/ "single file". Attach to process doesn't work in this case. If anyone is still struggling with this when publishing as "self contained" application - you have to publish as "framework dependent" to be able to attach debugger remotely.
-
GuidoG about 2 yearsI had something simular, tried dozens of solutions, nothing worked for me, until I finally discovered the problem. I wrote an answer about it in a similar question
-
Nicolas Raoul over 11 yearsThe question is about express edition, to which this answer does not apply, unfortunately. Actually none of the answers work for me, I also tried removing the Debug folder and rebuilding.
-
D-Sect about 11 yearsThis also handles situations where you are trying to debug a WEB project that is a .NET remoting endpoint running on the VS development server and showing "no symbols loaded".
-
Bala Kumar over 10 yearsIF you are using Attach To process, Tools ---> Attach To process Then Check Attach to Should be Automatic: Native Code. Our Source file should be in Read only mode. Mouse hour the opened source file and Check
-
Chiefy over 10 yearsMake sure that [Debug Info:] is set to [full] - fixed it for me! I have multiple configurations set up on my project, the new ones I added didn't have this set.
-
stevekrzysiak almost 9 yearsFor others who have tried everything on this page, I fixed my issue by switching to 'Managed (v4.5, v4.0) code'!
-
Aloha over 8 yearsTurns out I was in the release build. tsk.
-
Bartosz over 8 yearsThis should actually be upvoted somewhere to the top. I spent lots of time doing all the answers above, but the breakpoint would actually be hit. Just check:) Also, that was a WPF desktop app.
-
Zargold about 7 yearsWorked for me in Microsoft Visual Studio 2013 under: File > Close Solution Then File > Open Solution (should be preloaded with the same folder it was in). Breakpoints went from yellow flag to circular red instantly. So thanks.
-
Jazimov almost 7 yearsJust to be clear: In VS 2017, this setting is specifically in the Tool, Options dialog under the Debugging, General pane (there is no "Debug" pane, to be accurate). The checkbox is called "Enable Just My Code" not "Just My Code".
-
Jason almost 7 yearsi did pdb_only, also clean and restart browser
-
envyM6 almost 7 yearsOur project was using VSTS... this saved my headache... Thanks
-
Akshay over 6 yearsWhere is the project file. How can I find that file.
-
done_merson over 6 yearsIt is the .proj file.
-
tfrascaroli over 6 yearsCan I upvote 10K times? The worst of it all is that I think I've searched for this on google like 10 times now, and everytime is the same stupid mistake. Perhaps Microsoft could hint it to the user?
-
Dipak Telangre over 6 yearsI was running in
release
mode. Thanks !! -
Ben about 6 yearsKey for me was that the 'Deploy' box wasn't checked, thus the pdb wasn't being re-deployed after building
-
Appetere over 5 years@DaveInCaz thank you for down-voting my correct answer, which gave a clear instruction on how to fix the problem. The answer you linked to doesn't actually tell you how to set the configuration, which my answer does.
-
StayOnTarget over 5 yearsI did not downvote the answer. I generally would not do so unless it were actually incorrect. Someone else might have noticed my comment and downvoted?
-
phuclv over 5 yearsit's not a good idea. It's better to compile in debug mode and then change to release mode after all has been done
-
Ben over 5 yearsYes, just remove the executables, rename them if occupied.
-
melicent about 5 yearsI ran into the same problem a few days later and the above solution didn't knock it out for me this time. I'm running my solution using docker-compose and it turns out the problem was with the dockerfile of my project. Whatever VS originally dumped into that file wasn't building the image correctly or putting it in the right place.
-
FrenkyB over 4 yearsI can not change this setting, it's grayed out. I am running VS as administrator.
-
Brian almost 4 yearsThis seemed to help. Thanks
-
Enrico almost 4 yearsThis should not give the symbol warning
-
Gxzzin over 2 yearsInfo that saves lives! Thank you!
-
mneumann over 2 yearsI noticed I was not actually starting the project I was trying to debug facepalm. So look out for that, too, if you have a multi project startup configuration, make sure you include the project you're trying to debug!
-
Jaroslav Záruba about 2 yearsTo beginners (like me) your reply can easily be interpreted like "Release Mode is the way to go." I suppose you meant "check whether your solution is in Release Mode and change it to Debug"...?
-
randyh22 about 2 yearsI am working with a Blazor project with .NET 6 and Visual Studio 2022 and I was searching all over for why my breakpoints were not going to be hit. Then I read this solution and went back and tried it and, sure enough, it still hit my breakpoints. Ugh.
-
RonRonDK about 2 yearsThat was the only thing that worked for me too. Thanks!
-
Top-Master about 2 yearsIn C++, we can enable "generate minimal debug info for release", where the
.pdb
file acts like so-called "source-maps" (known from JavaScript), but without losing any optimization or performance. -
Top-Master about 2 yearsDoes C# support something like that for release?
-
Jeremy Caney about 2 yearsThere are 125 existing answers to this question, including a top-voted, accepted answer with over twelve hundred votes. Are you certain your solution hasn't already been given? If not, why do you believe your approach improves upon the existing proposals, which have been validated by the community? Offering an explanation is always useful on Stack Overflow, but it's especially important where the question has been resolved to the satisfaction of both the OP and the community. Help readers out by explaining what your answer does different and when it might be preferred.
-
Admin about 2 yearsYour answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-
Mohido about 2 years@JeremyCaney I have looked into many proposals in this thread. Not all the ~125 answers. However, I have not found a similar problem same as the one I was getting. My setup though is a bit different since I am using a CMAKE setup, yet, I am having the same error. Finally, it turned out that I was linking the "shaderc_combined.lib" instead of the "shaderc_combinedd.lib". This mistake is difficult to spot. Thus, I am expressing a possibility that a linking typo can be the producer of such an error. This solution is preferred when dealing with a C++ project with multiple ".libs".
-
A.K.M. Arifur Rahman almost 2 yearsYour instructions are easy to understand. it perfectly worked for me.