Diagnostic Messages in the Output Window
This article applies to Visual Studio 2015. If you're looking for Visual Studio 2017 documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2017. 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 output in the Debug version of your program. Use the Trace class if you want output in both the Debug and Release versions.
Writemethods, which output information without breaking execution. These methods replace the
Debug.Printmethod used in previous versions of Visual Basic.
System.Diagnostics.Debug.Assert and System.Diagnostics.Trace.Assert methods, which break execution and outputs information if a specified condition fails. By default, the
Assertmethod 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 breaks execution and outputs information. By default, the
Failmethods 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.