C# program exits immediately if UseWPF/UseWindowsForms set to true
Breaking change in .NET 5
.
MS Docs:
OutputType
is automatically set toWinExe
for Windows Presentation Foundation (WPF) and Windows Forms apps. WhenOutputType
is set toWinExe
, a console window doesn't open when the app is executed.(...)
Recommended action
No action is required in your part. However, if you want to revert to the old behavior, set the
DisableWinExeOutputInference
property totrue
in your project file.<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
Your app is quitting because there is no standard input to use ReadLine()
on.