New option in Visual Studio 2019 keeps console window open after debugging

For as long as I've been writing console applications, I've at the end of Main I've always had a piece of code to require user input before exiting when in debug mode, in order to review any output before the window closes. Not an onerous task, but one I immediately do as soon as creating a new application.

New features?

Today I created a new .NET Core console application in Visual Studio 2019 preview and added by code without a second thought.

When I ran the application I was in for two surprises - the first was the icon had changed, to a fetching purple. The second was, after the program had ran and displayed my usual "(Press any key to exit.)" message, the console stayed open - with another message to press a key to exit.

A small change, but a welcome one! And, just in case it's not to everyone's liking, there's even an option to disable the behaviour if you don't like it.

Always a catch

Unfortunately, this new option doesn't seem to work for old school console applications using the full .NET Framework, so I'll continue adding my boilerplate blocks to any new .NET Framework console applications I create.

About The Author


The founder of Cyotek, Richard enjoys creating new blog content for the site. Much more though, he likes to develop programs, and can often found writing reams of code. A long term gamer, he has aspirations in one day creating an epic video game. Until that time, he is mostly content with adding new bugs to WebCopy and the other Cyotek products.

Leave a Comment

While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported