Lately I have been having some issues with debugging a fairly simple Visual Studio 2010/SharePoint 2010 project. Whenever I deploy the project to the farm, Internet Explorer launches, tries to connect to the SharePoint site and more often than not the web server times out before the debugger is attached and the site is up and running. Occasionally it loads after a long wait period but will normally time out before I get a chance to do any real debugging.
Watching VS 2010 I can see that the Visual Studio has packed and deployed the solution quickly. What I notice was the symbols loading slowly. This was noticeable because VS displays the symbols loading at the bottom of the screen. Normally these will load quick enough that they are hard to read. Now I had time to write them by hand.
Retraction of the solution by VS2010 performed quickly. If I did a Ctr-F5 to Run with out Debugging the solution was deployed and the site was displayed very quickly which makes sense because the debugger was not trying to attach to the process.
After doing some Binging on symbols slow to load there seems to be a set of potential reason why Visual Studio ( and not just VS 2010) will slow down when loading symbols. Most issues relate to someone changing the location to retrieve the symbols such as Microsoft ( internet latency) and having networked drives that were not attached ( time outs waiting on the drives). There was even an article about multiple version of the .Net framework potentially causing an issue. None of these issues appeared to be the cause of the problem. I even went as far as doing a repair on VS 2010.
After more digging, I ran across a single forum thread that someone commented on the fact that the debugger was slow to attach because of a “bad” breakpoint. Basically the post suggested that a breakpoint that might have been valid at one time, was no longer valid for whatever reason and the debugger was stumbling over it slowing down the attachment process.
The solution to my issue? Simply delete all the breakpoints in the project. Right after I deleted all the breakpoints Visual Studio deployed the solution and the site launched in seconds, not minutes. It appears that deleting all the breakpoints using the “Delete All Breakpoints” menu item under the Debug menu removed all valid and “invalid” breakpoints and let me get back to work which for today is a custom Web Part using Model View Presenter.