如何单步执行在运行时解析的类型上的方法?

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

我有一个方法 1,它调用在 运行 时间内动态解析的类型中的方法 2。该类型驻留在我拥有其来源的引用程序集中。我在 method2 的调用中在 method1 中放置了一个断点,并且在其 .cs 文件中的 method2 上有一个断点。我正在使用 Visual Studio 2015 更新 3 和 Resharper。 (我也有 CodeRush)。

我无法单步进入 method2,也无法执行 method2。调试器单步执行到下一行,然后单步执行到 method2。 ctrl-alt-click on method2 显示 "Implementations of method2 were not found"。 ctrl-click on method2 进入它的界面。

我想知道如何在调试过程中打入 method2。

(1) un-check 要求源文件与原始语句完全匹配,并在 TOOLS->Options->Debugging 下启用 Just my Code。

(2)引用汇编调试,请确保dll文件和PDB文件都复制到引用它的工程output(Bin\debug)路径下

(3) 请检查它是否真的在调试模式下在 Debug->Modules windows 下加载了这个程序集。

(4) 使用程序集参考安装的项目参考也可以帮助您缩小此问题的范围。