14

I am using C# and reflection to load and invoke methods from an assembly. I have the source code of the assembly itself. What do I need to do to get the debugger to step into (and not over) the code of the dynamically loaded assembly ?

If I press F11 on the ....Invoke line it just steps over it ..

Thanks

G-Man
  • 7,232
  • 18
  • 72
  • 100

4 Answers4

12

Do you have the PDB files colocated with the DLLs, having been built from the sources in their current locations?

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • yes I have the pdb file for teh assembly - I will try to put it in the directory where the app is running from – G-Man Aug 18 '09 at 19:06
11

Build the source locally of dynamically loaded assembly and make sure you have the PDB files where the referencing app is running.

This is a common requirement for people wishing to debug the ASP.NET MVC source code. There are some caveats regarding the GAC though.

Another quick (but dirty) way to do is to temporarily add the project for the dynamically loaded assembly to your solution. This is what Steve Sanderson recommends for debugging the ASP.NET MVC framework. Personally I prefer the PDB root.

Community
  • 1
  • 1
RichardOD
  • 28,883
  • 9
  • 61
  • 81
1

I know this is a post long time ago, just want to contribute the web case.

If you are doing web project and loading assembly dynamically, If you are using IIS as development server, don't forget to restart Application Pool.

Victor Xie
  • 148
  • 1
  • 9
1

I had the same issue.

Solution:

  1. Use the same Build folder for all projects in your solution (Right click every project -> properties -> Build -> Output path (I used "..\bin\Debug" for all projects). Have a look on you Configuration. It need to be "Active (Debug)" for all your path changes.
  2. Create a project build always if you changed a single row in you DLL project. Your DLL file has to be exactly the same version, like your C# sources in Visual Studio.

And it works like a charm...