How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?

1,520,979

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:

  1. Right mouse click your project
  2. Select [Properties]
  3. Select the [Build] tab
  4. Make sure [Define DEBUG constant] and [Define TRACE constant] are checked
  5. Make sure [Optimize Code] is unchecked
  6. Click the [Advanced] button at the bottom of the Build tabpage
  7. Make sure that [Debug Info:] is set to [full]
  8. 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.

Share:
1,520,979
Instance Hunter
Author by

Instance Hunter

Updated on April 25, 2022

Comments

  • Instance Hunter
    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
      Vasyl Boroviak over 14 years
      Made them both load debug info. And try to unload one of the projects you do not run at the moment.
    • Polyfun
      Polyfun over 14 years
      When 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
      Instance Hunter over 14 years
      Express edition does not have Modules view.
    • Tim Coker
      Tim Coker over 12 years
      Good 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
      Muhammad Azeem over 11 years
      I 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
      Bhaumik Patel over 11 years
      I 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
      Hot Licks over 10 years
      Well, 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
      Prageeth godage about 9 years
      Did do all step except deleting the C:\Windows\Temp file and after deleting it works fine. ....... :D
    • Anders Finn Jørgensen
      Anders Finn Jørgensen over 8 years
      I 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
      live-love over 8 years
      Make sure all your projects are loaded in your solution. I had one that wasn't and that's what was causing the problem.
    • kuskmen
      kuskmen over 7 years
      I 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
      Roland almost 7 years
      Removing the .suo file might have solved this ugly problem at my project
    • Marc.2377
      Marc.2377 over 5 years
    • Alex
      Alex about 4 years
      Thanks 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
      tfa about 4 years
      Had to restart my PC not restart VS but restart my PC and debugging came back working
    • Rehmanali Momin
      Rehmanali Momin about 4 years
      The first thing to check would be that the Solution Configuration on the top bar should be in Debug mode.
    • Alexandru
      Alexandru over 3 years
      Check 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
      Kris over 2 years
      I 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
      GuidoG about 2 years
      I 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
    Nicolas Raoul over 11 years
    The 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
    D-Sect about 11 years
    This 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
    Bala Kumar over 10 years
    IF 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
    Chiefy over 10 years
    Make 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
    stevekrzysiak almost 9 years
    For others who have tried everything on this page, I fixed my issue by switching to 'Managed (v4.5, v4.0) code'!
  • Aloha
    Aloha over 8 years
    Turns out I was in the release build. tsk.
  • Bartosz
    Bartosz over 8 years
    This 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
    Zargold about 7 years
    Worked 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
    Jazimov almost 7 years
    Just 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
    Jason almost 7 years
    i did pdb_only, also clean and restart browser
  • envyM6
    envyM6 almost 7 years
    Our project was using VSTS... this saved my headache... Thanks
  • Akshay
    Akshay over 6 years
    Where is the project file. How can I find that file.
  • done_merson
    done_merson over 6 years
    It is the .proj file.
  • tfrascaroli
    tfrascaroli over 6 years
    Can 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
    Dipak Telangre over 6 years
    I was running in release mode. Thanks !!
  • Ben
    Ben about 6 years
    Key for me was that the 'Deploy' box wasn't checked, thus the pdb wasn't being re-deployed after building
  • Appetere
    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
    StayOnTarget over 5 years
    I 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
    phuclv over 5 years
    it'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
    Ben over 5 years
    Yes, just remove the executables, rename them if occupied.
  • melicent
    melicent about 5 years
    I 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
    FrenkyB over 4 years
    I can not change this setting, it's grayed out. I am running VS as administrator.
  • Brian
    Brian almost 4 years
    This seemed to help. Thanks
  • Enrico
    Enrico almost 4 years
    This should not give the symbol warning
  • Gxzzin
    Gxzzin over 2 years
    Info that saves lives! Thank you!
  • mneumann
    mneumann over 2 years
    I 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
    Jaroslav Záruba about 2 years
    To 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
    randyh22 about 2 years
    I 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
    RonRonDK about 2 years
    That was the only thing that worked for me too. Thanks!
  • Top-Master
    Top-Master about 2 years
    In 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
    Top-Master about 2 years
    Does C# support something like that for release?
  • Jeremy Caney
    Jeremy Caney about 2 years
    There 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
    Admin about 2 years
    Your 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
    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
    A.K.M. Arifur Rahman almost 2 years
    Your instructions are easy to understand. it perfectly worked for me.