When using
using System.Diagnostics;
and
Debug.WriteLine("Test");
having run the application, no "Test" can be seen in output. But if I use the msgbox function instead, the msgbox pops up, so the line is reached.
Am I looking in the wrong window or what do I have to change?
I am using VC# Express.
WriteLine calls may not display in the output window if you have the Visual Studio option "Redirect all Output Window text to the Immediate Window" checked under the menu Tools → Options → Debugging → General. To display "Tools → Options → Debugging", check the box next to "Tools → Options → Show All Settings".
Writes information about the debug to the trace listeners in the Listeners collection.
Example: Debug. WriteLine("Hello World"); Finally, press Ctrl+Alt+O to open the output window. Your text will be printed there.
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.
On Menu > tools > options > debugging > General:
On Project Properties > Build:
On the Output window:
There are two likely causes for this behavior
Debug.WriteLine
call is not in the final programThe easiest way to diagnose this is to change the code to
#if DEBUG Console.WriteLine("the message"); #endif
If it prints then you have an issue with the trace listeners, else you're compiling in Release
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