我在 C# 中有一个使用 Visual Studio 2010/2015 的 .NET 4.0 的 Excel-DNA 项目。
如果我启动调试并使用“启动外部程序”功能启动 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.
这两种情况有什么区别?“启动外部程序”与手动附加有什么不同?