VS2010 project runs slow when attached to debugger

I had an interesting problem occur to me today. I was using a new installation of Visual Studio 2010 Ultimate onto a machine other than my usual development machine. I needed to do some performance analysis on a machine that was nearer to a deployment configuration.
After copying the code project over and running the project as normal inside the debugger, I found it to be extremely slow. General interaction was a bit sluggish, but the chunks of code that did some serious work were crawling. Running the program outside the debugger (CTRL+F5 instead of F5) found the application to run at normal speed.
After a couple of reboots and head scratching, upon investigation I found that people were suggesting to delete any breakpoints, so I went to the debug menu to delete all, but it was greyed out (I assume because no breakpoints were present).
So I added a breakpoint on a line of code and then went to the menu option and removed all breakpoints. Strangely after this the code started working at full speed.


Popular Posts