|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Debugging Managed Code
This section covers common debugging problems and techniques for managed applications, or applications written in languages that target the common language runtime, such as Visual Basic, C#, J#, and C++. The techniques described here are high-level techniques. For more information, see Common Language Runtime Overview or Using the Debugger.
In This Section
- Diagnostic Messages in the Output Window
Describes theand classes, with which you can write run-time messages to the Output window. These classes include output methods that enable information output without breaking execution and information output that also breaks execution if a specified condition fails.
- Assertions in Managed Code
Describes assertions in managed code, which test conditions that you specify as arguments to Assert methods. In addition, this topic provides example code, information on using Debug and Trace class methods, considerations in Debug and Release versions of code, side effects, assert arguments, customizing assert behavior, and configuration files.
- Stop Statements in Visual Basic
Describes the Stop statement, which provides an alternative to setting a breakpoint. Example code is also provided, along with comparisons between the Stop statement and the End statement, as well as between Stop and the Assert statement.
- Walkthrough: Debugging a Windows Form
Gives step-by-step instructions for creating a Windows Form and debugging that form. A Windows Form, a standard component of a managed Windows application, is one of the most common managed applications. This walkthrough uses Visual C# and Visual Basic, but the techniques for creating a Windows form with C++ are generally similar.
- Debugging the OnStart Method
Provides code examples to allow you to debug the OnStart method of a managed Windows service. To debug the OnStart method of a Windows service, you must add a few lines of code to simulate the service.
- Mixed-Mode Debugging
Discusses debugging mixed-mode applications. This means any application that combines native code with managed code.
- Error: Debugging isn't possible because a kernel debugger is enabled on the system
Describes an error message that occurs if you try to debug managed code on a machine running Windows NT, Windows 2000, or Windows XP that has been started in debug mode.