Time saving tips when debugging

Share

Did you ever write some code, compile & run your solution and then, when debugging, found a minor error (like an sql string syntax error) that messed up your code’s execution? Well, stopping the debugger, correcting the error, recompiling & running is the way to go, right? Wrong! Visual Studio has two tricks up it’s sleeve:

1. Setting next statement

2. “Edit & continue “

1. While you debug, the next statement that will be executed is marked with a yellow background and a yellow arrow mark on the left side of the line. You can drag that arrow to the next statement that you want to execute. It may be in the previous lines or forward, in the following lines.

img

Keep in mind that going back / forward in the code is not like time travel though, if you move the execution point backwards, intervening instructions (like updating a variable) are not undone. Moving the execution point forward will skip parts of code, but you cannot move the execution point outside the current function. You can move your execution point inside an if statement even if the condition has not been met or skip out of a “for” statement etc. This can sometimes have unpredictable outcome so make sure you use it mostly for simple “oops” type bugs, not complex logic errors.

2. Edit and continue is the ability to alter running debug code to incorporate code-changes on the fly. When you resume execution of the program by choosing an execution command like Continue or Step, the new code is compiled and the debugging continues with the new code. This allows you to make changes to your code during a debugging session, instead of having to stop, recompile your entire program, and restart the debugging session.

Even if Edit&Continue’s usefulness is obvious, it also has a downside:  sloppy code may come along with it. The less expensive errors become, the fewer checks and mental effort we’ll expend ensuring that they don’t get into the code in the first place.

But how do we get the best efficiency? Checking and re-checking the code before we run it (like punch cards programmers used to) or just getting rid of compilation errors, run it and, when the program blows up, fix the errors one by one using the 2 tricks presented above? I believe the answer is: neither. Neither double/triple checking the code nor runtime patching and fixing alone won’t get you the best “deal”. The combination of these will. Try to write code as error safe you can, but don’t waste your whole day on it. If there are errors to be fixed on the way (hey, no code is perfect!), do them but don’t rely too much on E&C!

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close