views:

327

answers:

3

I have built a Library project (DLL) in .NET. And sometimes I use the DLL along with its PDB file as a reference in some other projects.

Now in the new project, I cant browse through the code of the DLL to debug. I can only see the definitions of class/methods/variables. That's by using "show definition" by browsing through the "class view"

However, only in case of an exception I the contents of the DLL opens and I could see the entire code of the DLL from the new project.

How could I see the contents (code) of the DLL before an exception occur?

A: 

If an app loads the DLL while running under the Visual Studio debugger, it should load the symbols automatically. If all you have is a DLL, you may need to write a "driver" app that does nothing but load and exercise the DLL entry points.

Tim Sylvester
+2  A: 

If you just need to browse the code, load the dll up in Reflector -- you don't even need the PDB file: http://www.red-gate.com/products/reflector/

JMarsch
I actually want to debug through the DLL file. It is also worth mentioned that I have the complete code for the DLL as I have built it. But when referencing that DLL in another project I can only see metadata but not the code, and I cant put a breakpoint for debugging
ala
Well, here are 2 options, since you have the code:1. Add the dll's project to your solution. (this lets you step through the host code and the dll)2. Load your dll project in Visual Studio, and attach the debugger to the exe (Debug | Attach to Process). I have used this method to debug a UFL dll that I wrote for Crystal Reports (attached the debugger to Crystal, and stopped on a breakpoint in my ufl dll).
JMarsch
There is also a debugging plug-in for Reflector that is supposed to let you debug in reflector. I've never tried it though. Follow the plug-ins link on redgate's site.
JMarsch
A: 

If you want to debug your application programmaticaly, take a look at Mdbg (managed dbg). You can also take a look at pdb2xml source, which give you good example of ISymbolReader interface, and how to use it to read pdb files.

arbiter