无法在从C#调用的C ++ / CLI使用的C DLL中设置断点

时间:2022-09-01 09:05:15

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.

我有一个C ++ / CLI对象调用的本机C DLL,它是C#中WPF程序的ViewModel。我想在C DLL中设置断点。当我尝试设置它们时,它们会变灰并且帮助气球说断点当前不会被击中。没有为此文档加载任何符号。

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.

要使程序运行OK,我必须添加一个自定义生成步骤,将DLL,PDB,ILK和LIB文件复制到C#主程序的中间目录。我怀疑这与问题有关。

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.

当我查看已加载模块的列表(Debug - Windows - Modules)时,在我知道DLL已加载并且其中的某些函数被执行的点之后,我看不到DLL。我看到C#主程序和调用C DLL的C ++ / CLI模块。

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.

所有这些项目都在同一个解决方案中 - 我是否需要运行单独的解决方案实例才能调试DLL?理想情况下,我希望能够调试本机DLL以及调用GUI代码。

thanks

1 个解决方案

#1


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

由于您在托管代码中的入口点,您需要设置以下选项:在Visual Studio-> entry project - > properties - > Debug - > Enable unmanged code debugging < - checked

#1


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

由于您在托管代码中的入口点,您需要设置以下选项:在Visual Studio-> entry project - > properties - > Debug - > Enable unmanged code debugging < - checked