Поделиться через


Debugging Managed Code

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic applies Topic applies

Managed only

Topic applies

Pro, Premium, and Ultimate

Topic applies Topic applies

Managed only

Topic applies

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#, and C++. The techniques described here are high-level techniques. For more information, see Using the Debugger.

In This Section

  • Diagnostic Messages in the Output Window
    Describes the Debug and Trace 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 Windows 7, Windows Vista, Windows XP, Windows 2000, or Windows NT system that has been started in debug mode.

  • JIT Optimization and Debugging
    Describes the effects of JIT optimization on debugging.

  • Debugging LINQ and DLINQ
    Discusses techniques for debugging LINQ queries.

  • Walkthrough: Debugging a Parallel Application
    Describes how to use the Parallel Tasks and Parallel Stacks tool windows to debug a parallel application.

  • Tracing and Instrumenting Applications
    Describes tracing, a way for you to monitor the execution of your application while it is running, and instrumenting, which involves placing trace statements at strategic locations in your code. This topic also provides links to an introduction to instrumentation and tracing, trace switches, trace listeners, tracing code in an application, adding trace statements to application code, and compiling conditionally with Debug and Trace.

  • /ASSEMBLYDEBUG
    Describes a linker option that adds DebuggableAttribute to code written with C++. This attribute is needed to use debugging features such as attach with C++.

  • Debugging Windows Service Applications
    Provides considerations for debugging Windows service applications, including setting up, attaching to the process, debugging the code in the service's OnStart method and the code in the Main method, setting breakpoints, and using the Services Control Manager to start, stop, pause, and continue your service.

  • Debugging and Profiling
    Discusses debugging .NET Framework applications and the configuration requirements.

  • Debugging Script and Web Applications
    Describes common debugging problems and techniques you may encounter when debugging script and Web applications.

  • What's New in the Visual Studio Debugger
    Description of new debugging features added in this release of Visual Studio.

  • Debugging Home Page
    Provides links to the larger sections of the debugging documentation. Information includes what's new in the debugger, settings and preparation, breakpoints, handling exceptions, edit and continue, debugging managed code, debugging Visual C++ projects, debugging COM and ActiveX, debugging DLLs, debugging SQL, and the user interface references.

See Also

Tasks

Walkthrough: Debugging Custom Windows Forms Controls at Design Time

Concepts

Debugger Security

Other Resources

Debugging in Visual Studio