Coder Perfect

Writing to the Visual Studio output window

Problem

For debugging purposes, I’m attempting to write a message to the output window. I looked for a function similar to Java’s system. out.println(“”). Debug.Write, Console.Write, and Trace.Write were all used. It doesn’t throw an error, but it also doesn’t output anything.

“Define DEBUG constant” and “Define TRACE constant” options are checked.

The “Redirect all Output Window text to the Immediate Window” option is not checked in the Tools Options Debugging menu.

Configuration: Active (Debug)

Note: I created a project with the wizard as “Windows Forms Application” if relevant. I have no idea where to look.

Asked by previous_developer

Solution #1

You can then use Debug.WriteLine() to rapidly publish a message to the IDE’s output window after adding the System.Diagnostics namespace. Please see the following for more information:

Answered by Bhargav Bhat

Solution #2

This will produce the following output in the debug output window:

using System.Diagnostics;

Debug.WriteLine("Send to debug output.");

Answered by veight

Solution #3

Debug.WriteLine

is exactly what you’ve been looking for.

If not, try the following:

Uncheck Debugging in the Tools Options menu. Immediate output should be sent.

Answered by Micah Armantrout

Solution #4

Only the Trace namespace, not the Debug one, worked for me:

System.Diagnostics.Trace.WriteLine("message");

I’m working in Visual Studio 2010 on a C# project.

Answered by Zac

Solution #5

You might be on the lookout for

MessageBox.Show()

or

Debug.Writeline()

Answered by dansasu11

Post is based on https://stackoverflow.com/questions/9466838/writing-to-output-window-of-visual-studio