Debugging Unmanaged C++ DLL from C#

  • Thread starter Thread starter dvestal
  • Start date Start date
D

dvestal

Sorry if this double-posts, google just crashed on me. I'm trying to
debug an unmanaged C++ DLL from a C# application. The C# app
references the DLL using DLLImport attributes. They are in the same
solution.

Here's what I've done so far:
1) Enabled unmanaged debugging in the C# application's property pages.
2) Set the DLL's output folder to the same location as the C# app's
output folder.
3) Enabled debug info in the C++ DLL, and verified that a PDB file is
created in the output directory.
4) Enabled the "debuggable assembly" attribute in the DLL.
5) Compiled everything in debug mode, obviously.
6) In the Modules window, verified that the DLL appears, and that
symbols were loaded for it.

But I can't step into the DLL's source code. What am I missing?
 
Sorry if this double-posts, google just crashed on me. I'm trying to
debug an unmanaged C++ DLL from a C# application. The C# app
references the DLL using DLLImport attributes. They are in the same
solution.

Here's what I've done so far:
1) Enabled unmanaged debugging in the C# application's property pages.
2) Set the DLL's output folder to the same location as the C# app's
output folder.
3) Enabled debug info in the C++ DLL, and verified that a PDB file is
created in the output directory.
4) Enabled the "debuggable assembly" attribute in the DLL.
5) Compiled everything in debug mode, obviously.
6) In the Modules window, verified that the DLL appears, and that
symbols were loaded for it.

But I can't step into the DLL's source code. What am I missing?

Have you tried just to set a break point in C++ code? The chances
are that you may not be able to step into unmanaged code from managed
code, but you still should be able to stop in unmanaged code.
Also, you may want to try to play with 'Debugger Type' setting
in the C++ project properties. I have a different scenario (COM
interop) and C++ project is my start up project. Having Debugger
Type set to 'Mixed' allows me to hit break points in both C++
and C# code.
 
I've tried both of those things, but neither work. This is very
strange to me...how can the "modules" window say that symbols are
loaded, yet I can't see the source code?
 
I've tried both of those things, but neither work. This is very
strange to me...how can the "modules" window say that symbols are
loaded, yet I can't see the source code?

Hm... Have you looked at Debug/Processes/Attach? I remember playing
with this in a similar situation.
 
Back
Top