Click here to Skip to main content
15,905,614 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I find that Console.Writeline no longer works in VS 2022. Why? Do I have to do something to turn it on?

What I have tried:

I have tried using Console.Writeline as I did in previous versions of Visual studio.
Posted
Updated 18-Feb-23 20:05pm
Comments
Dave Kreskowiak 18-Feb-23 20:43pm    
It has nothing to do with Console.WriteLine, not does it have anything to do with Visual Studio. VS doesn't execute the code.

Without seeing your code, it's impossible to tell you what's going on.

Also, what kind of application is this? Windows Forms, WPF, ... ?

1 solution

Console.WriteLine works fine in all apps for me - including in those compiled in VS2022.

However, if you are expecting it to write on your app display, it will only do that if you selected "Console App" as your project type - Windows, Web, and Hybrid apps use different mechanisms for interacting with the user.

If you are using a non-console project type, then Console.Write methods output to the Debug Console, which is only visible in the "Output" Pane of the debugger while your app is running under the debugger - so in "Release" builds of your app it will not be seen at all.
 
Share this answer
 
Comments
0x01AA 19-Feb-23 10:03am    
I guess it would be forwarded anyway to DebugOutput which can be observed with tools like 'Dbgview.exe'. But it is only a guess.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900