0

While debugging a mixed mode application in VS2010, the breakpoint set on a line of code contained in an unmanaged c++ dll source file (called from a managed c# wrapper class) shows the infamous "The breakpoint will not currently be hit. No symbols have been loaded for this document" info message when hovering the mouse over the breakpoint on the line in question. The breakpoint itself is a red circle with a yellow info triangle instead of the usual solid red orb. Of course, the breakpoint isn't hit when the debugger is executed. Most answers I've found for this warning indicate the breakpoint hasn't been set properly, or that the expected dll is not being loaded, or that the associated pdb file is not located in the correct location, etc. etc. This is not the problem. The application does load and execute the referenced dll correctly. I've verified that the correct pdb file, with the same file date as its dll, is located in the executable's working directory along with the target dll itself. The debugger simply doesn't load the symbols for the dll, and the dll doesn't show in the Modules list.

None of the solutions I've found online work for this problem. The dll doesn't show in the modules list available from 'Debug->Windows->Modules' menu selection... even though it is, in fact, loaded. Breakpoints set in the wrapper class work correctly.

Deleting the bin and obj directories, cleaning and rebuilding the solution also doesn't help.

signitariat
  • 111
  • 1
  • 6

3 Answers3

7

The solution to this problem was to set the "Enable unmanaged code debugging" flag located in the Debug tab of the application's properties page

signitariat
  • 111
  • 1
  • 6
  • Just to clarify, that is the solution _sometimes_. I've forgotten how I solved the same problem myself when that flag was already properly set. – Windows programmer Sep 18 '12 at 05:07
  • Yes, if the pdb file is not located in the executable's directory, the same warning will manifest. In fact, anytime the debugger cannot find the symbol file for a given assembly you will see this warning. Since I had compiled the solution (including the project in question) in the Debug configuration, it hadn't occurred to me that VS2010 would require a separate setting to debug the source at hand. Go figure. – signitariat Sep 18 '12 at 15:28
  • This worked for me. Note that in VS2015, the option is called "Enable native code debugging." – cherno Aug 01 '16 at 21:24
-1

You aren't hitting the code, and aren't having the dll show up in your modules list, because it's not being loaded by the program. So whatever your C# wrapper is calling, it's not that - or maybe that's not getting called correctly.

Peter
  • 7,216
  • 2
  • 34
  • 46
  • Not the problem. The dll does load and it does run. True, it's not showing in the modules list, but it executes. The pdb file is also located in the app's working directory along with its referenced dll and other dlls/pdbs referenced by the app. All other referenced dlls with their associated pdbs work and load correctly. Of course, they are all c# managed dlls and not unmanaged c++ dlls. – signitariat Sep 17 '12 at 22:40
-2

It's a little unclear as to what your error is, but if you are getting the message that says "the breakpoint will not currently be hit", it means exactly what it says - you are not hitting a breakpoint you set. Try looking back in you program and see where the breakpoints are (they should be red dots in the margin), then see if you are actually getting to them

MrBretten
  • 27
  • 7