0

I am attempting to debug a class library in VS2013, however whenever I set a breakpoint in the library, it seems to be ignored when executing the code.

I am using a console project, which is located in the same solution to call the code of the class library. I've added the .dll, which has been generated by the class library, as a reference to the console project in order to connect the two projects.

How do I connect the two projects properly and stop VS2013 from ignoring the breakpoints?

Jan Berktold
  • 976
  • 1
  • 11
  • 33
  • What do you mean by "I have added the dll?". How did you do that? How did you reference the other project? – Gerrie Schenck Jan 20 '14 at 14:54
  • Sounds like you have linked to a compiled DLL version of your class library. Instead, you should have the class library and test project in a single solution and reference the project for the class library, not the DLL file. – John Willemse Jan 20 '14 at 14:56
  • @GerrieSchenck Right click on References > Add Reference and select the .dll file generated in the bin/Debug directory of the class library project. – Jan Berktold Jan 20 '14 at 14:56
  • @JohnWillemse I have both projects in the same solution, however how do I access the class library from the console project? – Jan Berktold Jan 20 '14 at 14:57
  • @JanBerktold Select 'References' > 'Add reference' and select the class library from the 'Projects' tab; do not use 'Browse' to browse for a DLL. – John Willemse Jan 20 '14 at 14:58

2 Answers2

0

Sounds like you need the PDB file(s) associated with the library's (DLL) files.

Without PDB files, it's possible to set a breakpoint on the library code, if you can see it, but the red breakpoint circle will say something like "Symbols could not be loaded...." and you won't land on any breakpoints.

So, if you can get the PDB files of the library, copy them to the bin folder of your project, add a reference to the library DLL, and hopefully that should make Visual Studio happy.

Also, when debugging the code in VS, if you go to Debug->Windows->Modules, that will open a new window in the IDE which shows loaded assemblies. That window will also tell you whether the symbols (PDB) have been loaded.

Community
  • 1
  • 1
Jason Evans
  • 28,906
  • 14
  • 90
  • 154
0

My solution had two class libraries, one application that needed them. Couldn't break anywhere in the class library code. All settings previously mentioned here were checked. I solved it by removing the class library dll from the references and then adding it back in as a reference. Voila. Previously ignored breakpoints in the class library became active.