Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Debug Unmanaged Dll from C#

I have a DLL that was written in C++ and called from a C# application. The DLL is unmanaged code.

If I copy the DLL and its .pdb files with a post build event to the C# app's debug execution dir I still can't hit any break points I put into the DLL code. The break point has a message attached to it saying that "no symbols have been loaded for this document".

What else do I have to do to get the debugging in the dll source?

I have "Tools->Options->Debugging->General->Enable only my code" Disabled. The DLL is being compiled with "Runtime tracking and disable optimizations (/ASSEMBLYDEBUG)" and Generate Debug Info to "Yes (/DEBUG)"

like image 353
QueueHammer Avatar asked Nov 16 '09 21:11

QueueHammer


People also ask

How do I enable debugging in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.


1 Answers

To debug into your C++ DLL you need to enable mixed mode debugging on the startup application in your solution.

  • Right click on project -> Properties
  • Go to Debug Tab
  • Check "Enable unmanaged code debugging"

This will allow you to debug into native code for an F5 style scenario. If you want to enable it for attaching to the process then do the following in the "Attach to Process" Dialog

  • Select the process to debug
  • Click on the "Select ..." button above the process list
  • Click "Debug these code types"
  • Check both Managed and Native
like image 198
JaredPar Avatar answered Oct 11 '22 16:10

JaredPar