Visual Studio. NET provides debugging features that are primarily discussed as part of the new content for some developers. The primary technique involved in debugging is to set breakpoints and use them to check what happens in a place during code execution.
1. Breakpoint
In Visual Studio. NET, you can set breakpoints on any line in the code that executes. The easiest way to do this is to click the line in the Code Editor, that is, click the row in the shaded area to the left of the document window (or select the row, press the F9 key) so that a breakpoint is set on the line, and the code is interrupted as soon as it executes to the line, handing control over to the debugger. Visual Studio. NET highlights the text and background of the line in another color. When you click the Circle again, the breakpoint is deleted.
2. View variable
When you encounter a breakpoint, you typically view the value of the variable. The easiest way to do this is to put the mouse pointer over the variable name in the Code Editor, and a small box appears, giving the value of the variable. You can also use local variables to view the contents of a variable, which is a tabbed window that only appears when the program is running in the debugger, as shown in Figure 1.11.