views:

63

answers:

6

Occasionally during debugging the debugger skips forward randomly. Sometimes I Step into a function inside of another function and instead of going to the next line it skips through to a seemly random place in the future. sometimes to a line partway through another function. It always seems to respect breakpoints though, i.e. if a breakpoint is set in the future it never will skip past it.

I'm running 64 bit Win 7 and visual studio 2010 ultimate. This never happened for me in visual studio 2008. How can I fix this?

+1  A: 

Are you sure that the assembly your code calls has debug symbols? You maybe referencing a dll that was compiled in release mode.

Kevin Raffay
+2  A: 

Do you have optimizations turned on? If the program is highly optimized, the order of execution can be thrown off, and things can be expanded or rearranged in ways that are not always clear.

Adam Shiemke
+2  A: 

This can happen when the debugger is running against pdb files that don't match the source code you are looking at. Make sure the bin (or where you are running from) is up to date and was built from the same source code you are running in the debugger.

aqwert
A: 

Click Rebuild Solution.

Omer Raviv
A: 

I'm running into similar problems debugging a C# program with Visual Studio 2010 on an XP machine. The debugger just randomly skips to some other line or the next break point.

I found the following on a Microsoft board. According to the 10/1/2010 post from Microsoft, they admit that it is a bug and they are working on a fix.

https://connect.microsoft.com/VisualStudio/feedback/details/556756

I sure hope they fix it soon. It's very annoying and happens to me often.

+1  A: 

Are you using threads or background workers? When debugging I believe that all threads are paused so it could be switching between them. Otherwise you may have out of date debugging information, Delete your bin and obj directories and do a clean build.

Jason Goemaat