无法在从 C# 调用的 C++CLI 使用的 C DLL 中设置断点
我有一个由 C++/CLI 对象调用的本机 C DLL,该对象是 C# 中 WPF 程序的 ViewModel。 我想在 C DLL 中设置断点。 当我尝试设置它们时,它们呈灰色,并且帮助气球显示当前不会命中断点。 该文档尚未加载任何符号。
为了让程序正常运行,我必须添加一个自定义构建步骤,将 DLL、PDB、ILK 和 LIB 文件复制到 C# 主程序的中间目录。 我怀疑这与问题有关。
当我查看已加载模块列表(调试 - Windows - 模块)时,在我知道 DLL 已加载并执行其中的某些函数后,我看不到 DLL。 我看到 C# 主程序和调用 C DLL 的 C++/CLI 模块。
所有这些项目都在同一个解决方案中 - 我是否需要运行该解决方案的单独实例才能调试 DLL? 理想情况下,我希望能够调试本机 DLL 以及调用 GUI 代码。
谢谢
I have a native C DLL being invoked by a C++/CLI object which is the ViewModel for a WPF progam in C#. I want to set breakpoints in the C DLL. When I try to set them they are grayed out and the help balloon says the breakpoint will not currently be hit. No symbols have been loaded for this document.
To get the program to run OK I had to add a custom build step which copies the DLL, PDB, ILK and LIB files to the intermediate directory of the C# main program. I suspect that has something to do with the problem.
When I look in the list of loaded modules (Debug - Windows - Modules), after a point at which I know the DLL has been loaded and some functions in it executed, I don't see the DLL. I see the C# main program and the C++/CLI module which invokes the C DLL.
All these projects are in the same solution - do I need to be running a separate instance of the solution in order to debug the DLL? Ideally I want to be able to debug the native DLL as well as the calling GUI code.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您的入口点位于托管代码中,因此您需要设置以下选项:
在 Visual Studio 中-> 入门项目-> 属性-> 调试->
启用非托管代码调试 <- 选中
Since your entry point in managed code, you'll need to set the following option:
In Visual Studio-> entry project -> properties -> Debug ->
Enable unmanged code debugging <- checked
现在,12 年后,@Scott Weinstein 他的回答的本质仍然有效。
至少在 Visual Studio 2019 中,只有一些内容已重命名。
为了帮助您更快地完成任务,以下是您正在寻找的设置:
Visual Studio 2019
->解决方案资源管理器
->您的启动项目
->属性
->调试
-> 检查启用本机代码调试
Now, 12 years later the essence of @Scott Weinstein his answer is still valid.
Only things have been renamed in at least Visual Studio 2019.
To help you on your way, more quickly then myself, here is the setting you are looking for:
Visual Studio 2019
->Solution Explorer
->your start-up project
->properties
->Debug
-> CheckEnable native code debugging