[Webinar] Learn how to a build a cloud-first strategyRegister Now


How do I debug a referenced DLL in Visual Studio?

Posted on 2014-08-17
Medium Priority
Last Modified: 2014-08-25
My team has built an assembly and there seems to be a problem in it.  The assembly is just referenced in my main project.  What are the steps, if any, to debug this from my main project?
Question by:Bruce
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 664 total points
ID: 40266401
First of all, add the dll project to your testing project through File...Add...Existing Project.

In the References window, instead of referencing the dll as you do with most dlls, go into the Solution or Projects tab (depending on your version of Visual Studio) and select your dll project instead of the dll itself. This is akind to referencing the source code.

The debugger will then be active in both the testing application and the dll, switching from one project to  another as necessary, even if you debug step by step.
LVL 27

Accepted Solution

Sammy Ageil earned 668 total points
ID: 40266407
Rebuild the problematic project in Debug mode on your own machine (so that file paths in that PDB are specific to your machine).

Copy both .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.

If you don't have the code, you can use .Net Reflector (It's commerical now) http://www.red-gate.com/products/dotnet-development/reflector/
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 668 total points
ID: 40266416
Rebuild the problematic project in Debug mode on your own machine (so that file paths in that PDB are specific to your machine).
This is very important. The .pdb files have to be the ones generated at the time of the build. Even if you have a set of .pdb files that exactly match in source code, if they were not from the same exact build, then you won't be able to use them.

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month20 days, 13 hours left to enroll

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question