Tuesday, March 30, 2010

Visual Studio 2008: "The breakpoint will not currently be hit. No symbols have been loaded for this document"

I faced this annoying problem on Visual Studio 2008 when I was debugging my dll project using an external exe as the Application (remote executable). I had debugged the same project earlier and it used to work fine. I don't know what changed suddenly to cause this problem.

I tried most of the suggestions from forums like this but it didn't help.

Here is the solution that worked for me:

Look at the module listing under Debug-> Windows-> Modules while debugging . The 'Symbol Status' of the modules you want to debug may show up as either 'No symbols loaded' or 'Symbols not loaded'.

Delete the Debug folder and rebuild your project.

Go to Tools -> Options -> Debugging -> Symbols. Under 'symbol file (.pdb) locations' click add a new location pointing to the pdb file's folder (usually the Debug folder of your project).

Voilà! The breakpoints should now be hit!

Please comment if this solution worked for you. If not, let me know what worked. Although this worked for me in Visual Studion 2008 (VS2008), it might also work in Visual Studio 2005 (VS2005).