Visual Studio: Debugging a referenced DLL, I have source in another SLN

C#Visual Studio-2010Visual StudioVisual Studio-Debugging

C# Problem Overview


I am trying to debug a project that has a reference to a DLL that I added, the DLL is stored in an external directory and I just added a reference. Now of course I can debug my project but the line that calls a method on my other dll I can't step into it, i.e. F12.

One way I was able to do this was to add my project (dll) as an existing project to my solution and replace the referenced dll to use the attached project rather than a file on disk.

But what a mess, I am sure there is a cleaner way?

I seem to remember if I copy some PDB files or something but i can't remember. And Do i need to open 2 copies of visual studio, 1 for my main project and 1 for my referenced DLL??

C# Solutions


Solution 1 - C#

Rebuild the second solution in Debug mode on your own machine (so that file paths in that PDB are specific to your machine).

Copy both the .DLL and .PDB files to your references folder. Visual Studio will pick up the .PDB file automatically and use the file paths to show source.

You can also use Symbol Server and Source Server to achieve this when the referenced assembly is built elsewhere: http://msdn.microsoft.com/en-us/library/vstudio/ms241613.aspx

Solution 2 - C#

I got the solution by doing the below

Try disabling Just My Code (JMC).

Tools -> Options -> Debugger Uncheck "Enable Just my Code"

Solution 3 - C#

I had same problem which I resolved by cleaning and rebuilding the solution . It will correct references in .pdb files to locate and hit the break point in second project.

Solution 4 - C#

When you do a Debug build, all of the dll and pdb files are established in the host project. So there should be no need to copy files manually.

Right-Click on the Solution, select Add/Existing Project... Navigate to the Class lib folder and select the proj file (e.g. myproj.csproj). The files are not copied, just referenced and you can open the source for the class in the IDE and set breakpoints in the normal way and it just works.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMartinView Question on Stackoverflow
Solution 1 - C#KnaģisView Answer on Stackoverflow
Solution 2 - C#Dilip JangidView Answer on Stackoverflow
Solution 3 - C#AamolView Answer on Stackoverflow
Solution 4 - C#Cool BlueView Answer on Stackoverflow