Unable to set breakpoints in C DLL used by C++/CLI called from C#

◇◆丶佛笑我妖孽 提交于 2019-12-24 00:37:45

问题


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


回答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



来源:https://stackoverflow.com/questions/765745/unable-to-set-breakpoints-in-c-dll-used-by-c-cli-called-from-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!