Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug dynamically loaded assembly in Visual Studio .NET

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

like image 762
G-Man Avatar asked Aug 18 '09 18:08

G-Man


2 Answers

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

like image 59
Jon Skeet Avatar answered Oct 06 '22 09:10

Jon Skeet


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.

like image 28
RichardOD Avatar answered Oct 06 '22 09:10

RichardOD