C.5. Other FeaturesVisual Studio 2005 provides many new debugging features, that simplify the testing and debugging process. We discuss some of these features in this section. C.5.1. Edit and ContinueThe Edit and Continue feature allows you to make modifications or changes to your code in debug mode, then continue executing the program without having to recompile your code.
In this example, we wanted to make a change in the text for our input prompt before line 11 executes. However, if you want to make a change to a line that already executed, you must select a prior statement in your code from which to continue execution.
Certain types of change are not allowed with the Edit and Continue feature once the program begins execution. These include changing class names, adding or removing method parameters, adding public fields to a class and adding or removing methods. If a particular change that you make to your program is not allowed during the debugging process, Visual Studio displays a dialog box as shown in Fig. C.28. Figure C.28. Dialog box stating that certain program edits are not allowed during program execution.
C.5.2. Exception AssistantAnother new feature in Visual Studio 2005 is the Exception Assistant. You can run a program by selecting either Debug > Start Debugging or Debug > Start Without Debugging. If you select the option Debug > Start Debugging and the runtime environment detects uncaught exceptions, the application pauses, and a window called the Exception Assistant appears indicating where the exception occurred, the type of the exception and links to helpful information on handling the exception. We discuss the Exception Assistant in detail in Section 12.4.3. C.5.3. Just My Code™ DebuggingThroughout this book, we produce increasingly substantial programs that often include a combination of code written by the programmer and code generated by Visual Studio. The IDE-generated code can be difficult for novices (and even experienced programmers) to understandfortunately, you rarely need to look at this code. Visual Studio 2005 provides a new debugging feature called Just My Code™, that allows programmers to test and debug only the portion of the code they have written. When this option is enabled, the debugger will always step over method calls to methods of classes that you did not write. This feature is not available in Visual Basic 2005 Express. If you have the complete Visual Studio 2005, you can change this setting in the debugger options. Select Tools > Options.... In the Options dialog, select the Debugging category to view the available debugging tools and options. Then click the checkbox that appears next to the Enable Just My Code (Managed only) option (Fig. C.29) to enable or disable this feature. Figure C.29. Enabling the Just My Code debugging feature in Visual Studio.C.5.4. Other New Debugger FeaturesThe Visual Studio 2005 debugger offers additional new features, such as visualizers, tracepoints and more, which you can learn about at msdn.microsoft.com/vstudio/express/vb/features/debug/default.aspx. |