Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio 2022 console closes after running/ debugging code

I feel really dumb for having to ask this question, but how do I stop the console on visual studio 2022 from closing automatically after I run a code? When I try to run/ debug, the console opens for a brief moment then automatically closes so I cannot check my outputs.

I have tried unchecking/ checking the checkbox under tool-> debugging -> “automatically close the console when debugging stops” and restarting the software, but it still does the same thing.

like image 969
John R Avatar asked Aug 19 '26 18:08

John R


1 Answers

I have observed this behavior when the standard input is redirected from a file in the project debug options. In this case, the console is always closed automatically, no matter what options are set in Visual Studio preferences.

The only solution I have found in this case is not to redirect standard input, or place a breakpoint at the program end.

like image 110
Guillermo Hernán Martín Avatar answered Aug 22 '26 12:08

Guillermo Hernán Martín