Zurechtweiser Zurechtweiser - 2 months ago 13
C# Question

Debug.WriteLine shows nothing

When using

using System.Diagnostics;



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.


There are two likely causes for this behavior

  • The application is being compiled in Release mode and the Debug.WriteLine call is not in the final program
  • There is no trace listener in the program and hence nothnig to output the message

The easiest way to diagnose this is to change the code to

Console.WriteLine("the message");

If it prints then you have an issue with the trace listeners, else you're compiling in Release