1

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?

ManojRawat
  • 61
  • 1
  • 8
  • 1
    "surprisingly its still compiling." - That's really telling. Set a breakpoint at one place, where you'd expect your `Caller` to call into `Comsumer` and step into it. See where you end up. What you can also try: Hit "Clean" (Menu: "Build" => "Clean Solution" in Visual Studio) and then recompile. Also make sure, IDE is set to "Debug", not "Release". – Fildor May 30 '23 at 12:29
  • I cannot step into the `Consumer` method, that's the pain here, when i do it is pops up the message box saying "symbols has no implementations" . Yes, IDE is set to "Debug" . Clean and Rebuild is also done multiple times but no luck. – ManojRawat May 30 '23 at 12:32
  • And you build the whole solution? That's kind of weird it's only a Runtime-Error. Is this inside of reflection code or something like that? – Fildor May 30 '23 at 12:40
  • Yes i did build the whole solution. No its not inside reflection, just a simple class library (Consumer) having a class with some methods there and the Caller project is just calling them on its end. There's no error, i am just not able to go inside/step into that Consumer Project's method. – ManojRawat May 30 '23 at 12:46
  • Can you show a code example? Just out of curiosity. There must be something. If the reference is missing, the compiler _must_ fail it. If the reference is there and everything compiles just fine, you should be able to step into... – Fildor May 30 '23 at 12:50
  • 1
    Could you show us the XML node that defines the project reference inside the caller's `.csproj` file? Look for XML nodes like ` – Good Night Nerd Pride May 30 '23 at 12:52
  • @Fildor yes that's what i think too. Can it be possible that the caller project is referncing the consumer project's dll from the GAC instead of bin\Debug? I'll add the sample code in the question. – ManojRawat May 30 '23 at 13:20
  • @GoodNightNerdPride , the project reference tag in caller's `.csproj` file is something like this `{Project idConsumer` – ManojRawat May 30 '23 at 13:25
  • Double check the directories. Maybe there is a second version of the consumer project in your filesystem that is referenced by the caller, but the solution is loading another version. This can happen when copy & pasting project directories. In .net framework the solution is not a representation of your file tree (as it is in .net core). – Good Night Nerd Pride May 30 '23 at 13:31

1 Answers1

0

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.

ManojRawat
  • 61
  • 1
  • 8