0

I have a dll built from mixed code in VS 2012. This dll is loaded from a .exe built in native C++.

When I debug the dll (via F5 from VS 2012), the breakpoints are not hit. The message is :

No executable code is associated with this line. Possible causes include: preprocessor directives or compiler/linker option

However when I run the exe from Windows explorer then perform "attach to process", all the breakpoints are hit.

I tried changing the debugger type to "Mixed", "Native", "Managed", I also played with debugging options but the results were all the same; except when the debugger type is "managed", the breakpoints seem to be loaded (a filled red circle appears instead of an empty red circle) but are not hit.

Can you please give me an explanation of this strange phenomenon ?

Brainless
  • 1,522
  • 1
  • 16
  • 30
  • Are all pdb's found and loaded when starting it from the debugger in the IDE? Something like "Symbols for dll not loaded"? – KimKulling Aug 19 '14 at 11:40
  • From the error message and the fact that the debug works when using "Attach to process", I deduce that the pdb is loaded. – Brainless Aug 19 '14 at 12:31
  • Does debugging mixed code requires some particular settings ? – Brainless Aug 19 '14 at 12:32
  • *I tried changing the debugger type to "Mixed", "Native", "Managed"* you mean you selected all three of them in Tools->Options->Debugging->Just in Time ? And when debugging, if you go to the Modules window, does it say symbols are loaded? If not, can you load them manually (right-click->Load Symbols I think)? – stijn Aug 19 '14 at 17:32
  • The symbol of my dll is loaded. – Brainless Aug 20 '14 at 02:40
  • The debugger type is accessible from project properties -> debugging – Brainless Aug 20 '14 at 02:40

1 Answers1

1

When starting a debugging section with the false debug path ( this can be set in the project properties ) it can happen, that the pdb will not be loaded, because the working directory is not at the executable with the pdb. So no information about the source location is there and the debugger can answer: No executable code is associated with this line. When starting the application directly the working directory is normally the place where the application is located, the pdb get's loaded breakpoint get's hit. When debugging the app check if the corresponding pdb get's loaded, just to be sure that everything is right here.

KimKulling
  • 2,654
  • 1
  • 15
  • 26
  • Thanks for your answer. What is the "debug path" ? The dll I'm trying to debug and the exe are in the same path. Is it the debug path ? From the output I can see that the pdb is loaded. – Brainless Aug 19 '14 at 13:12
  • look: http://msdn.microsoft.com/de-de/library/kcw4dzyf.aspx and check for Working Directory – KimKulling Aug 19 '14 at 13:15
  • 1
    Strange, I found this topic, maybe some news for you there: http://stackoverflow.com/questions/15205750/breakpoint-will-not-currently-be-hit-no-executable-code-associated-with-this-li – KimKulling Aug 19 '14 at 13:43