Search code examples
c#visual-studio-2015resharpervisual-studio-debuggingcoderush

How to single step into a method on a type that's resolved during runtime?


I have a method1 which calls a method2 in a type that's resolved dynamically during run time. The type is resides in referenced assembly whose source I have. I put a breakpoint in method1 on the call on method2 and I have a breakpoint on method2 in its .cs file. I am using Visual Studio 2015 update 3 and Resharper. (I have CodeRush too).

I can't single step into method2 and I can't go to implementation of method2. The debugger single steps to the next line before single stepping into method2. ctrl-alt-click on method2 shows a "Implementations of method2 were not found". ctrl-click on method2 goes to its interface.

I was wondering how to break into method2 during debugging.


Solution

  • (1) un-check Require source files to exactly match the original statement and Enable Just my Code under TOOLS->Options->Debugging.

    (2) For the reference assembly debugging, please make sure that the dll file and the PDB file are all copied to the project output(Bin\debug) path which refer to it.

    (3) Please check that whether it really loaded this assembly under Debug->Modules windows during debugging mode.

    (4) Using the project reference installed of the assembly reference also could help you narrow down this issue.