visual studio 2008 crazy debugger skipping!

What the hell could be causing this....

I'm developing my C# 3.5 ASP.NET MVC web app, same as I do all day every day. Not doing anything clever, just standard methods on classes calling other methods...

I build my project, fire up a url in Chrome, and get the response I expect. I attach the debugger to w3wp.exe, set a breakpoint and f5 in Chrome. The debugger stops at the breakpoint as I'd expect....

I hit f11 to step through the code, and it will move to the next line/part line, do it a few times and it will randomly skip to an arbitrary line in the execution path!!!

The line it skips to is a line that would have been executed, it doesn't skip to any old line, it just decides to miss out a whole bunch of lines in between??!!!

I've never seen this before, how the hell do I debug what's going on???

For a while I thought perhaps Chrome is making two requests, and the debugger isnt really skipping, its just swapping between request threads making it look like its jumping about, but thats not it! If i set a breakpoint on every single line i can partially prevent it, but take the following:

1. public string Method()
2. {
3.     string s;
4.     s = OtherMethod();
5.     return s;
6. 
7. }

the type of behaviour im seeing (with a breakpoint on every line above) is 1,2,3,4,5,6,7 (i.e. it wont step into OtherMethod();

Other behaviour im seeing is 1,2,3 and then thats it, off back to wherever called Method() or even further away :s

Thanks

Answers


Have you tried cleaning your solution? - (the bin and obj folders in your project folder)

Delete files from the temporary asp.net files folder?

  • (usually C:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files)
  • You probably will need to run "iisreset /stop" at the command prompt first, then re-enable with iisreset /start

Hey, you probably found a workaround on this by now but many people (I was one) still struggle with it. It's a VS 2008 problem and this fix should be applied:

http://support.microsoft.com/?scid=kb%3Ben-us%3B957912&x=9&y=14


Not sure if this will help. I have run into issues before where the compiled code in a related assembly doesn't match up with what the debugger thinks I have. The way I always solved it was to frist shutdown VS, then restart and reload the project, then do a full rebuild of the solution. Then change build mode from debug->release or release->debug, and do one last rebuild. I've honestly never figured out what causes it. Only happens on occasion.


Sounds like you are trying to step through a binary that's been optimized. The optimizer can do lots of things that make it hard to debug including but not limited to:

  • Reordering statements
  • Inlining functions

I've seen something similar in 2.0 when I don't ensure that my browser cache is clear.


Turn on disassembly and see if your stepping makes more sense. If you're certain that you aren't jumping between threads, then the compiler has probably decided that some of your code isn't important enough to step to (i.e., does nothing).


Need Your Help

Trying to a fix a broken UL border

html css html5 css3 html-lists

I need your help. For some reason, I cannot seem to get my border to seamlessly line up with its parent element. The example below depicts the problem that I am having:

C and C++ compilers with "aggressive" volatile semantics

c++ c x86 volatile smp

Are there any C or C++ compilers out there that implement "aggressive" memory consistency model for volatile variables? By "aggressive" consistency model I mean accompanying all writes to volatile