Zurechtweiser Zurechtweiser - 1 year ago 87
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download