Bagikan melalui


Diagnostic Messages in the Output Window

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic applies Topic applies

Managed only

Topic applies

Standard

Topic applies Topic applies

Managed only

Topic applies

Pro and Team

Topic applies Topic applies

Managed only

Topic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

You can write run-time messages to the Output window using the Debug class or the Trace class, which are part of the System.Diagnostics class library. Use the Debug class if you only output in the Debug version of your program. Use the Trace class if you want output in both the Debug and Release versions.

Output Methods

The Trace and Debug classes provide the following output methods:

  • Various Write methods, which output information without breaking execution. These methods replace the Debug.Print method used in previous versions of Visual Basic.

  • Debug.Assert and Trace.Assert methods, which break execution and outputs information if a specified condition fails. By default, the Assert method displays the information in a dialog box. For more information, see Assertions in Managed Code.

  • The Debug.Fail and Trace.Fail methods, which always breaks execution and outputs information. By default, the Fail methods display the information in a dialog box.

In addition to program out from your application, the Output window can display the information about:

  • Modules the debugger has loaded or unloaded.

  • Exceptions that are thrown.

  • Processes that exit.

  • Threads that exit.

See Also

Concepts

Debugger Security

Introduction to Instrumentation and Tracing

Reference

Output Window

Other Resources

Tracing and Instrumenting Applications

Debugging Preparation: C# and Visual Basic Project Types

Debugging Managed Code