开发者

Visual Studio 2010 debugger skipping

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 b开发者_如何学JAVAreakpoint is set in the future it never will skip past it.

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


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.


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.

It seems that Microsoft has released a Fix for this in the SP1.


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


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.


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.


This can also happen when your Debug solution configuration is up to date, but you try to debug the program in Release configuration (if that is not also up-to-date)... or vice versa.

You can switch back and forth between running in Debug or Release configuration using the drop-down next to the green 'play' arrow at the top of the screen.


I had a similar problem in Visual C++ 2008 on Windows 7 32-bit recently. Several minutes before the problem first appeared, a system dialog window “VC.exe encountered a problem and needs to quit” was displayed but the Visual C++ window seemed to survive.

After the problem first appeared, I tried several ways to getting it back to work like rebuilding the solution or restarting Visual Studio. However, it continued to behave strange: It failed to link with an object file I hadn’t touched for weeks, displayed “The breakpoint will not currently be hit. The source code is different from the original version.” etc.

Nothing helped until I rebooted the computer and finally rebuilt the solution (twice, actually).


Click Rebuild Solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜