C# – How to solve the Single stepping problem with VS2008 SP1

cvisual-studio-2008-sp1

Debugging in visual studio seems to have been broken with sp1.
Single stepping randomly does not work and just starts to run. Sometimes breakpoints are ignored. It is unpredictable and unusable. It will generally hit the first break point but after that it is totally unpredictable.

Any idea what needs to be done to correct this behavior ?

Best Answer

Make sure you are debuging using the debug configuration, not the release one. Also make sure optimizations are disabled in debug configuration.

Optimizations must be off when you debug else it can lead to very erratic behaviours like these.


For C# projects, which I am assuming the question is about looking at the tags, the optimization option would be located in the "Build" tab of "Project > Properties..." Last option of "General" it's called "Optimize Code".