We app code execution sequence

Why does a web app not always run code sequentially (i.e.; top to bottom)? I had weird crap happening with my web app, so I placed a msgbox in line to display the state of a property, but the program just skips over the top of it as if it didn’t exist. I replaced the message box with a break point, but once again it just skipped right over the top of the breakpoint. The message box and breakpoint were not inside any type of logical comparator. Is this an issue? Its really hard to debug or develop a program if it won’t stop and let me look under the hood for broken parts. Do I need more coffee or an exorcist?

You should not use a MsgBox but rather System.Debuglog which does not disrupt the execution. If you are on PC, use DebugView to get the messages from a debug Web app. See http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

I would bet that the event where you placed your breakpoint simply does not occur. That is usually the most common explanation. Difficult to know what is going on without seeing your code, though.

Everything is taking place in a method. The program definitely lands on the method, so I know that bit happens

Then put a break at the beginning of the method, and use the little arrows thingies on top of the IDE to go step by step. That should show you exactly if and where execution jumps over lines.

Yeah, did that and it just jumps over the line. The trouble is that the line skipping is not consistent. I cleared the browser cache and this helped a bit, but after a while it just reverts back to being unpredictable. I understand that this is a digital environment and therefore should not be subject to ‘intermittent faults’, but this is acting like an analogue environment. I am going to open another bottle of shiraz and call a priest.

I remember encountering such a problem only once, and the bug has been fixed since.

Basically, an error in a line, instead of triggering an exception, failed silently, and prevented execution of subsequent code. But it did not jump a line ; it prevented execution until the end of the event.

Try to comment the line after which the jump occurs, and see if it still happens.

Is the code that’s being skipped inside of a loop of some kind? The debugger hits the end point first and then jumps back to the beginning if the loop will actually run.