Search code examples
c#.netwinformsvisual-studio-2019pdb-files

Cannot navigate as well as debug a method present in a class library project inside a .NET windows form solution


Here's the structure of the solution

  1. .NET 4.8 Framework Windows form Solution
  2. Consumer Project , .NET 4.8 Framework class library project
  3. Caller Project, .NET 4.8 Framework winform project. Consumer project has a project reference in Caller Project.

I have a weird situation here, I am trying to debug a method present in the Consumer project. But I am not able to debug it (break point never hits it) also , the method is showing 0 references in Visual Studio 2019. Apart from this, if I press CTRL+F12 or Go To Implementation in Visual Studio , it shows a message box saying the symbol has no implementations.

The winform solution has many class library projects like this but the problem is coming with this library only.

Things that i have done so far.

  1. Removed that project/library reference from the another project(the caller) and build the solution, surprisingly its still compiling.
  2. Deleted .suo files and debug folder and restarted VS but nothing worked.
  3. I tried enabling/disabling the code lens feature in VS for showing the references but nothing worked.

It seems like the Consumer project is acting like a 3rd Party project reference whose code is not in the solution, but that's not true. All of this started when i deleted the debug folder of the solution, is this something related to symbols ? Any idea why is this happening ?

Thanks in advance.

Edit: I do have checked the symbol loading part by following the accepted answer in below link and everything is in right place, the IDE is dumping the .pdb files and solution's .exe in the same place i.e. bin\Debug

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


Solution

  • Ok so finally the issue has been resolved.

    I was constantly trying to re refer the Consumer project reference by first deleting it from the references list and then again adding it but the Consumer project's methods were still showing 0 references in Visual studio. So this time i manually deleted the Consumer Project's reference entry from the Caller Project's .csproj file and build the project and then there were compilation errors which is obvious. After that I re added the Consumer Project reference again and build the project again. After this the references started showing up for all the Consumer project's methods.

    It seems like Visual Studio 2019 was not actually deleting the Consumer Project's entry from the project file when i was removing the reference from Visual Studio and that's why even after removing the Consumer project reference from the Caller project,the code was compiling without an error.