Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008 : Step to next line is very slow when debugging managed code

When stepping through my C# code line by line via F10, it takes the debugger over one second to get to the next line.

I've tried deleting all watches and breakpoints, but that did not make any difference.

Is this normal? It's been like this for quite a long time now, so I can't even remember if this was ever better. My development computer is a Quad-core machine with no background task activity and plenty of RAM left.

If it's not normal, what else could I try? It's still ok to work with, but a less sluggish user interface would be great...

like image 803
Adrian Grigore Avatar asked Nov 30 '09 17:11

Adrian Grigore


3 Answers

What's likely happening is you have a variable in the call stack frame which has an expensive .ToString method. In 2008, the data for the call stack window is rebuilt on every step regardless of whether or not the window is actually visible. Part of building this window will call .ToString on the values which appear in the parameter list if they have an overridden .ToString. Try disabling implicit .ToString calls and see if that fixes the problem.

  • Tools -> Options -> Debugger
  • Uncheck the "Enable Implicit .ToString calls"
like image 134
JaredPar Avatar answered Nov 09 '22 22:11

JaredPar


I have found that if you have the option to debug unmanaged code turned on, the debugger can take a while to step between lines even if you are only debugging managed code. Try turning that option off (Project > Properties > Debug > Enable Debuggers > Enable unmanaged code debugging).

like image 41
Kevin Kibler Avatar answered Nov 09 '22 23:11

Kevin Kibler


I tried all of the above. Unchecking 'Show Threads In Source' button fixed it.

like image 4
Clint Avatar answered Nov 09 '22 22:11

Clint