3

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

2 Answers 2

10

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

1
  • Thanks. I hadn't realised I should be looking for a debug property on the main GUI project, although that makes sense now.
    – Andy Dent
    Apr 19, 2009 at 22:10
1

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 -> Check Enable native code debugging

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.