4.6. The Visual Studio Debugger

Visual Studio provides a number of tools to help you detect errors in your programs. Intellisense is one of those tools that sits in the background carefully examining your program code as you type it into the Source window. Intellisense does a great job of finding syntax and semantic errors, but is less helpful in finding logic errors. Because the computer has no intelligence of its own, it blindly follows whatever instructions you give it even if those instructions are wrong. Once you have the syntax and semantics of your program stated correctly, you need a different tool to help you out if the program produces incorrect results. The next line of defense in fixing program errors is the Visual Studio debugger.

4.6.1. The Debugging Process

A debugger is a programming tool designed to help you fix program errors. Visual Studio has a powerful program debugger built into its IDE. The process of removing program errors is called debugging. There are four steps in the debugging process:

  1. Detection: Obviously, to be able to correct a program error you have to know the program contains an error in the first place. Detection requires that you have a set of data you can use to test whether the program is working properly. Quite often the test data set is generated by hand or is an input data set known to produce a correct result.

  2. Stabilize: Once you suspect that there is a program error, the next task is to stabilize the error. By stabilizing an error, I ...

Get Beginning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.