2

I have an ASP.NET web site which uses a compiled DLL from another Visual Studio solution (have the DLL's original solution -- .cs files, .csproj, .sln, etc.) as a reference.

There's an exception coming up to the web site from this DLL, and I'd like to debug it (the DLL). Can I do this? Can I drill down into the DLL, set break points, etc. somehow? I've heard of "attaching the debugger", but I have never done that, and certainly not with a DLL. What are the steps to do this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JamesBrownIsDead
  • 4,573
  • 3
  • 20
  • 10

1 Answers1

6

Stack Overflow question Debugging a third-party DLL in Visual Studio.NET? is asking the same thing. The answer for it is basically to use .NET Reflector to decompile the DLL and look a the code.

However, if you have the solution, and all source code, for the DLL then you could change the reference to point to the other project instead of the DLL. Then you can step into the functions as you would any other in the code.

Another way, again if you have the code, is to run the application and attach to the process. To do this, you would open the other solution in Visual Studio, and attach the debugger to the ASP.NET worker process (aspnet_wp or something like that if I recall correctly). This will allow you to set breakpoints and have them be hit when you go to the right parts of your website. It would be the ASP worker process i you are browsing to the site in Internet Explorer on your local IIS for example. If you are running it in Visual Studio then it is likely to be using the built-in web browser. So you would need to attach to that.

There might be a way to do it if you have the pdb files for the DLL as well, but I have never really tried to do that. I know that if you have the pdb files then you can get the source back when using tools like WinDbg to debug.

Community
  • 1
  • 1
Glenn
  • 1,169
  • 7
  • 14