1
votes

I am not being able to debug the code for a MVC4 application in VS-2012. The same code was running fine a few days back. Error as below: Breakpoint will not currently be hit. No symbols have been loaded for this document.

I have tried below possible ways:

  • Cleaning and rebuilding the solution.
  • Setting 'Just my code' to false and true both.
  • Repaired VS.
  • Cleared the bin and obj folders also related GAC and temp asp.net folder.
  • Checked in Debug->Windows->Modules, it gives 'Can not find or open PDB file', when tried to load manually, it can't find the pdb file though file is present in the mentioned location.
  • Checked that code is building in Debug mode with no optimization and Debug set to true in web.config file as well.
  • The problem persists even if I create a new project in VS.
  • Also tried reverting all the changes and took the latest version from TFS.

Any help on this is highly appreciated as I have gone through many threads but couldn't find a solution.

4
Have you tried running VS in administrator mode? - Rob Purcell
Are you connecting to the right process for debugging? localhost vs. IIS? - Imran Saeed
Try using System.Diagnostics.Debugger.Break() .before the line where you want to break. - Amitd
@Amitd in Debug->Windows->Modules I have noticed under User Code column VS mentions 'No', ie. its not treating my code as user code and hence not loading symbols neither automatically nor manually. Any clue why? Also, is there a chance that some thing in VS is corrupted and re-installation is the last resort? - manshuan
I doubt that could have happened. Its a possibility . Does it work with console applications. Create a small console app or new mvc app, but a break point and does that breakpoint get hit? - Amitd

4 Answers

0
votes

Try exiting the IIS express, which will enforce visual studio to relaunch IIS express and load symbols.

0
votes

One change did the trick for me, though not sure what exactly fixed it. Couple of projects were hosted in IIS. I deleted all the hosted sites form IIS, configured them again and that worked for me. However, still not sure what exactly was wrong in IIS but yeah, it was IIS.

0
votes

What worked for me was to open the solution as administrator, right click on the web project--> properties -->Web--> IIS express--> project URL same as in your iis, create virtual directory. save, build, rebuild, publish, run.

0
votes

Another thing to try is to enter the project properties (right click on the project in Project Explorer), Click the "Build" tab, Click "Advanced" in the lower right corner and choose an Output other then "None" (for example PDB-only). This should generate the necessary PDB file.

Advanced Build Settings