0

Question:
What's the equivalent of System.Out.Println() in C# ?
How to output something to vs IDE terminal?

Expect:
Console.WriteLine() should does the same. But it didn't in WPF project.

Tried solutions:
I have tried Debug.WriteLine() Trace.WriteLine() and nothing work

Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
Debug.AutoFlush = true;
Debug.Indent();

and Yes, break point hit there and pass.
Ya i clicked on the Output window and selected Debug,
ya I running on Debug no Publish.

Software:
IDE -> Visual Studio 2017
OS -> Windows 10

Verbose description:
I notice there is no easy way to output anything to the vs IDE output terminal. Doing some WPF project but Console.WriteLine(value) just show nothing to my IDE terminal. for web core project and WPF project, I just cant show my thing to my IDE terminal.

I just want output something to my IDE terminal like Java + Eclipse style, not a separate console terminal, not logging, not any fancy stuffs. PLEASE HELP.

verbose back story:
I've do a bunch of Console App project, play around VS IDE and C# , all work fine as I want.
I just don't understand how software is develop in C# nor how Visual Studio work. Wanted to do a Desktop Form App,
why there's WPF vs Windows Form App,
why Console.WriteLine() and Console.Out.WriteLine()
why someone would said Debug.Write() and some Trace.Write(), which neither one work
why there are so many similar options for 1 thing
which one is true? I keep research, I read book, I read doc, I learn nothing.
if possible point me to right direction too to all basic thing C# must know. thanks

A. Go
  • 63
  • 1
  • 9
  • Is this a console project, or a GUI/winforms/wpf application? – PhonicUK Jul 07 '20 at 22:23
  • He said it's WPF, and doesn't want to output to console. – Andrew Jul 07 '20 at 22:25
  • yes is WPF, and web project too. for Console App verything just Console.WriteLine() can be run and seen. Debug.WriteLine() just does seem to do anything either – A. Go Jul 07 '20 at 22:37
  • 1
    In `WPF`, the `Console.WrtieLine()` writes to the output window. You can bring it up by going to Menu > View > Output. – Sach Jul 07 '20 at 22:55
  • 1
    I just created a new WPF project, tried both `Console.Writeline` and `Debug.Writeline`, and **both** wrote to the Output window. I don't see any issue there. In Release mode, only the former is displayed, of course. – Andrew Jul 07 '20 at 23:15
  • After a bit more testing, I noticed that in a WPF .Net *Core* app, for some reason, `Console.WriteLine` doesn't seem to work. Only `Debug.WriteLine` works and writes to the Output window (or the Immediate one if you enable that option mentioned in the other question, linked above). – Andrew Jul 07 '20 at 23:31
  • About your other questions: WPF and Winforms are two very different approaches, each one with its pros and cons. Plenty of info on the web about that. [About Console.Out](https://stackoverflow.com/questions/1149131/why-does-console-out-writeline-exist). [About Debug vs Trace](https://stackoverflow.com/questions/179868/trace-vs-debug-in-net-bcl) (tl;dr: debug is only when debugging, trace works in release). – Andrew Jul 07 '20 at 23:36
  • Ok, I have resolved the issue. answer from: https://stackoverflow.com/questions/9466838/writing-to-output-window-of-visual-studio Menu Tools → Options → Debugging → "Redirect all Output Window text to the Immediate Window" MUST BE UNCHECKED. It was not showing due to filtering with the search bar in Options. Make sure empty the search so the option checkbox only shows. – A. Go Jul 08 '20 at 14:29

0 Answers0