I didn't see any output in the console or Visual Studio's output panel from:
Debug.Write("WriteStatements() was reached")
Where does the output go to?
Debug. WriteLine will display in the output window ( Ctrl + Alt + O ), you can also add a TraceListener to the Debug.
WriteLine(String) Writes a message to the trace listeners in the Listeners collection.
To see the debug output window, in Microsoft Visual Studio, click View, click Other Windows, and then click Output. You can view the debug output in this window only if the debugger is attached to the process that is writing to the output window.
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.
Zhaph's answer already told you a way to get to the output of Debug.Write
.
Under the hood, the default listener for Debug.Write
, i.e. System.Diagnostics.DefaultTraceListener
, calls the Windows API function OutputDebugString
.
Any message passed to that function can be displayed by a debugger, e.g. you will see the output in the Output window of Visual Studio.
Another quite simple way to see the output of Debug.Write
and/or Trace.Write
is to use DebugView, a tool from Sysinternals:
DebugView is an application that lets you monitor debug output on your local system, or any computer on the network that you can reach via TCP/IP. It is capable of displaying both kernel-mode and Win32 debug output, so you don't need a debugger to catch the debug output your applications or device drivers generate, nor do you need to modify your applications or drivers to use non-standard debug output APIs.
Please note, that Debug.Write
statements will not be included in a Release build, hence you would only see the output in the Debug build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With