When debugging the opened solution/project in Visual Studio (2015) I would like to debug (step into) a method call which is located in one of the referenced assemblies. The assembly has .pdb (copied local) and source code. This assembly actually is also my class lib project, but not in the current solution, instead in an other solution.
I know the trivial solution to debug this assembly would be adding its project to the current solution instead of referencing it, then debugging experience would be seamless. However for some reasons this would not be too efficient in my case, for example there are many assemblies (dozens) which I should add and I do not want to end with a giant solution.
What I've done/tried so far:
As I recall this debugging feature was sometimes surprisingly worked automagically, however now it does not.
What am I missing?
Right click on solution -> Add Existing Project -> then select the . csproj file of your external library (project B). Again in visual studio right click on (project A) -> Add -> Project Refference... -> and then add checkmark on your external library which you want to debug (project B).
Most common reasons of such experience are:
You've ruled out 1, so to check the other 2:
Open Debug->Windows->Modules and find assembly you are having problem with. Make sure it is loaded from location you expect, has version you expect, check if PDBs are loaded. You may need to try load/reload PDB to see if VS is happy with PDB it located.
If PDBs are matching VS should start asking about source location. Information about source is part of PDB so it will let you know if source matches or not (there is option to allow loading mismatched source files, but you'll get funny debugging expirience).
Note that if you library build for RELEASE it will be optimized and for some function you'll not be able to debug them at all due to inlining at JIT time or compile time optimizations of dead code (like if (false)
branches). For best expirience make sure to use DEBUG assembly with matching PDB and make sure to attach early with "suppress optimizations on load" in debugger options.
I have faced this problem as well and I have tried many tips. Yet I found out the problem in my context was:
I removed it and I could step into the dll code again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With