Console.WriteLine not showing in the Visual Studio Output window
Codemia Knowledge Hub ·
Console.WriteLine writes to the console, not to Visual Studio's Output window. In a Windows Forms, WPF or ASP.NET application there is no console window, so the text does not appear where you expect. Use System.Diagnostics.Debug.WriteLine to send debug messages to the Output window instead.
Why the output goes missing
- The project is not a console application. Windows Forms, WPF and ASP.NET apps do not have a console window by default, so
Console.WriteLineoutput is not shown anywhere obvious. - You are looking in the Output window. Visual Studio's Output window shows debugger output, which is separate from the console. Without the right configuration, console text will not appear there.
- Standard output is redirected. Your application's configuration may send standard output to a file or another stream.
Getting the output to show
- In a console application,
Console.WriteLinedisplays in a console window by default. Check that the project really is set up as a console application. - In other application types, redirect the output to a window or a file. A typical approach in Windows applications is to use the debugger output method
System.Diagnostics.Debug.WriteLine. - You can explicitly set the output stream for diagnostics in configuration files or main execution:
Console.SetOut redirects everything later written with Console.WriteLine. Debug.WriteLine calls are compiled only into Debug builds, so they produce nothing in a Release build.
Related reading
- Construct LambdaExpression for nested property from string
- ContextSwitchDeadlock Was Detected error in C
- Control.EndInvoke resets call stack for exception
- Convert a list to a string in C
- Constructing DataFrame from values in variables yields ValueError If using all scalar values, you must pass an index
- Consume the same message again if processing of the message fails
- Convert a string to an enum in C#
- Convert an array to a HashSetT in .NET

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.