本文介绍了“使用托管兼容模式"还是“启用本机代码调试"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为 Autodesk Revit 编写了 .net 插件.Revit 是非托管应用程序.因此,为了成功调试,我要为 Use managed compatible mode 选项或 Enable native code debugging 选项(或两者都设置)设置为 ON其中).否则无法启动调试.

I write .net-plugins for Autodesk Revit. Revit is unmanaged application. So, for successfully debugging I am to set into ON either for Use managed compatibility mode option or for Enable native code debugging option (or for both of them). Otherwise debugging cannot be launched.

第一个适用于所有项目.其中第二个单独用于每个项目.

The first of them is applied for all projects. The second of them is used for each project individually.

这些选项有什么区别?我不明白他们在做什么.在我的情况下使用哪个选项更正确?

What the difference of these options? I don't understand what they do. What option it is more correct to use in my case?

推荐答案

您不必启用非托管调试来调试您的插件.当宿主应用程序加载加载项时,代码中的断点将激活(从空心变为实心).如果您不确定这是否发生,请查看调试">Windows">模块"窗口.

You do not have to enable unmanaged debugging to debug your plugin. Breakpoints in your code will activate (turn from hollow to solid) when the host application loads your add-in. If you are not sure if this happened then have a look at the Debug > Windows > Modules window.

启用非托管调试不会对调试会话产生太大影响,但是它可能需要更长的时间才能开始,您可能需要暂时禁用符号服务器以避免对其感到恼火.

Enabling unmanaged debugging does not otherwise greatly affect the debugging session, it can however take quite a bit longer to get started and you may need to temporarily disable the symbol server to avoid getting annoyed at it.

工具">选项"设置的名称相当糟糕.Microsoft 一直致力于开发新的调试引擎,但被迫(或选择)放弃了一些功能.使用托管兼容模式"强制加载旧版本的托管调试器,即 VS2010 中使用的那个.调试 C++/CLI 代码时需要它.它在 VS2015 中也很有用,它的托管调试引擎非常有缺陷.您将错过一些新的调试功能,例如返回值检查和 64 位编辑+继续.否则您不需要它来调试您的加载项.

The Tools > Options settings have rather poor names. Microsoft has been working on new debugging engines but was forced (or chose) to drop some features. "Use Managed Compatibility Mode" forces an older version of the managed debugger to be loaded, the one that was used in VS2010. It is required when you debug C++/CLI code. It can be also useful in VS2015, its managed debugging engine is very buggy. You'll miss out on some new debugging features like return value inspection and 64-bit edit+continue. You don't otherwise need it to debug your add-in.

使用本机兼容模式"的情况大致相同,它启用了旧版本的非托管调试引擎,即 VS2012 中的一个 afaik.您将错过新的 Natvis 可视化工具.除了保持旧的可视化工具正常工作之外,我还没有找到需要它的令人信服的理由.

Much the same story for "Use Native Compatibility Mode", it enables an older version of the unmanaged debugging engine, the one in VS2012 afaik. You'll miss out on the new Natvis visualizers. I have not yet found a compelling reason to need it, other than keep the old visualizers working.

这篇关于“使用托管兼容模式"还是“启用本机代码调试"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 12:39