views:

176

answers:

2

I've got two DLLs, one in written in native C++ and the other in C++/CLI. The former is injected into a process, and at a later point in time, loads the latter. While debugging, I noticed that the native DLL's breakpoints were functioning correctly while the other's weren't, even though its code was being executed.

The breakpoints showed this message: This breakpoint will not be hit. No executable code associated with this line. Possible causes include: preprocessor directives or compiler/linker optimizations.

The modules window tells me that the plugin's symbols are loaded. I'm running with its DEBUG build. Any ideas on why this is so and perhaps a fix ?

A: 

I assume you're using Visual Studio. Do you have mixed-mode debugging switched on?

(Project Properties->Debugging->Debugger Type)

Stu Mackellar
I had the property set to Auto. Changing it to Mixed, or Managed only for that matter, didn't produce any results.
shadeMe
+1  A: 

The reason for what you faced is that the PDBs ("PDB stands for Program Database, a proprietary file format (developed by Microsoft) for storing debugging information about a program) are not up-to-date.

Try to clean the solution (that contains the managed code DLL) and rebuild it again.

Tip: if you are referring to the DLL, try to put the up-to-date pdbs beside the it. You can get the pdbs from your bin folder.

Sameh Serag
The issue persists even after cleaning and rebuilding the DLL.
shadeMe
Are you sure the latest pdbs exists in the same path as the dll you are referencing?
Sameh Serag
Yes, I manually copied it from the build directory after compilation.
shadeMe
Have you try to add a 'Debugger.Break();' explicitly in your dll and run your code normally to see whether you will be prompted to attach a debugger at this point or not?
Sameh Serag
Tried that during an earlier session, but did get the prompt. In retrospect, I think that was probably due to the fact that I was already debugging it. I'll try again and see if it works.EDIT: It does. You have my thanks.
shadeMe