Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console Window never appears in Visual Studio 2015

There appears to be a bug in Visual Studio 2015 where you can run a console application once and see the output window, and then never seen again when you run it after that.

No, the application is not executing so fast that I just do see it. You can see the .exe running in Task Manager and you have to End task to kill it.

Steps to reproduce:

  • Create a new console application in Visual Studio 2015
  • Just write Console.WriteLine("helllo!");Console.ReadLine();
  • Run it once, see the window.
  • Run it N more times, never see the window again.

This includes running with debugging and running without debugging.

Turning off "Enable the Visual Studio hosting process" in the project properties has no effect.

You can run the .exe from the file system and see the console window fine, it only doesn't appear it run by Visual Studio.

Has anyone else see this problem?

like image 939
Sam Rueby Avatar asked Jan 28 '16 19:01

Sam Rueby


People also ask

How do I enable console in Visual Studio?

With the console project open in Visual Studio for Mac, right click the project and select Options to open the Project Options dialog. In that dialog select Run - Configurations - Default. That page has a Run on external console check box which can be enabled or disabled.

Why is the console window closing immediately?

Because it's finished. When console applications have completed executing and return from their main method, the associated console window automatically closes. This is expected behavior.

How do I view console output in Visual Studio 2010?

In Visual Studio 2010, on the menu bar, click Debug -> Windows -> Output. Now, at the bottom of the screen docked next to your error list, there should be an output tab. Click it and double check it's showing output from the debug stream on the dropdown list.


2 Answers

This was happening to me - I eventually figured out that if I ran a console command in the "Package Manager Console", then tried to run the console application, the console wouldn't appear.

If I simply didn't use the Package Manager Console in a fresh instance of Visual Studio, the problem wouldn't occur.

like image 57
Coruscate5 Avatar answered Nov 09 '22 03:11

Coruscate5


I too am having this issue. I'm not entirely sure as to why this is happening... Possibly a change which is new to Visual Studios 2015?

However, I've found a few work arounds for the time being until such time.

First, Console.Read(); prevents both the debug and built solution from closing.

Second, "Start without debugging" worked without Console.Read(); when attempting a debug.

Following this thread. Glad I'm not the only one who is a little bit confused!

like image 44
John Smith Avatar answered Nov 09 '22 04:11

John Smith