编辑&继续仅在使用"启动外部程序"但不附加到流程

时间:2016-08-19 00:22:14

标签: visual-studio debugging edit-and-continue attach-to-process

我使用Visual Studio 2010/2015使用.NET 4.0在C#中有一个Excel-DNA项目。

如果我启动Debug并使用"启动外部程序"启动EXCEL.exe的功能我可以暂停调试器和编辑&继续完美无缺。

但是,如果我尝试附加到正在运行的EXCEL.exe进程,则会收到一条错误消息,指出编辑&由于各种原因之一,不支持继续。当选择附加到流程时,我只有"管理(v4.6,v4.5,v4.0)"地选择。

错误消息指出:

Changes are not allowed in the following cases:
- Attached to a process that does not support Edit and Continue on attach.
- The code being debugged was optimized.
- The assembly being debugged is loaded as domain-neutral.
- The assembly being debugged was loaded through reflection.
- Intellitrace events and call information is enabled.
- The .NET Runtime this program is running does not support edit and continue.

这两种情况有什么区别?什么"启动外部程序"做不同于手动附加?

1 个答案:

答案 0 :(得分:1)

这是well documented

  

以下调试方案中无法使用“编辑并继续”:

     
      
  • 使用“附加到”调试应用程序,而不是使用“调试”菜单中的“启动”运行应用程序。
  •   

使用“启动外部程序”选项找到的解决方法是正确的方法。