- Enabling Script Debugging
- Adding Debugger Statements
- Using IntelliSense
- Managing Breakpoints and Tracepoints
- Using Watches
- Additional Features to Explore
- Summary
Additional Features to Explore
At runtime, the Debug > Windows menu in Visual Studio offers several more dynamically added menu items that are quite useful. For example, the Call Stack, Output, and Immediate windows all offer features that I use frequently. The following list briefly summarizes some of the functions of the various windows:
- Watch. Provides access to up to four separate watch windows, all behaving identically, containing the Watch values you add.
- Autos. Displays variables in the current and previous statements.
- Locals. Displays all of the local variables.
- Registers. Shows the CPU registers. Not very useful for script debugging, but great for low-level programming.
- Memory. Shows actual memory contents.
- Call Stack. Displays the files and lines of code that represent the reverse order of your code as a stack of function branching.
- Disassembly. Shows the assembly code generated by the compiler.
- Threads. Shows all of the various thread IDs in your application.
- Modules. Shows all of the loaded modules (think DLLs and assemblies).
- Running Documents. Available if you're running external script.
- Immediate. One of my favorite features is the ability to type code directly into the Immediate window. You can create objects or just type a value, and the IDE recurses into the object display the properties and sub-properties of that object. You can also call functions in the Immediate window.
- Output. Displays searchable status information.
Additional options are available that facilitate debugging, but aren't necessarily related to script debugging:
- To attach to a process that's already running, choose Debug > Attach to Process.
- Debug > Exceptions enables you to manage which exceptions cause an application break.
- The Debug menu also offers Step Into, Step Over, and Step Out options, which support single-stepping while debugging.
- View > Object Browser lets you see and drill down into the vast number of libraries that make up the .NET Framework and all of the related DLLs that are available.
- Debugging and stepping operations are available for unit testing.
To round out our cast of debugging and supporting tools, you can connect to and debug devices, such as PDA emulators, or use Tools > Error Lookup to look up error codes. You can even try Spy++.