Send messages to the Output window
Applies to: Visual Studio Visual Studio for Mac
Observação
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
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 want output in the Debug version of your program. Use the Trace class if you want output in both the Debug and Release versions.
The Trace and Debug classes provide the following output methods:
Various
Write
methods, which output information without breaking execution. These methods replace theDebug.Print
method used in previous versions of Visual Basic.System.Diagnostics.Debug.Assert and System.Diagnostics.Trace.Assert methods, which break execution and output 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 System.Diagnostics.Debug.Fail and System.Diagnostics.Trace.Fail methods, which always break execution and output information. By default, the
Fail
methods display the information in a dialog box.
The Output window can also display information about:
Modules the debugger has loaded or unloaded.
Exceptions that are thrown.
Processes that exit.
Threads that exit.