Visual-studio – Visual studio 2008 crazy debugger skipping

debuggingvisual-studio-2008

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 do I debug what's going on?

For a while I thought perhaps Chrome is making two requests, and the debugger isn't really skipping, its just swapping between request threads making it look like it's jumping about, but that's 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 I'm seeing (with a breakpoint on every line above) is 1,2,3,4,5,6,7 (i.e. it won't step into OtherMethod()).

Other behaviour I'm seeing is 1,2,3 and then that's it, off back to wherever called Method() or even further away.

Best Answer

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