Why the console window disappears whenever I debug? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the console window disappears whenever I debug?

I'm using Microsoft Visual Studio 2015. and whenever I try to debug(f5), the program starts...and ends. Suggest that you are trying to debug the simple code below. int num = 0; Console.WriteLine(num); and? something happens, and ends. why this occurs, and how can I get over it? I need your help!(sry to poor Eng)

8th Dec 2016, 11:20 AM
B.virus
B.virus - avatar
2 Answers
+ 1
write at the end from the Main method Console.ReadLine();
8th Dec 2016, 11:31 AM
Max_N
Max_N - avatar
0
Console window closes because your program finished execution and there is nothing to wait. But you can add Console.ReadLine() after Console.WriteLine() statement and program will wait until you will hit enter key.
8th Dec 2016, 11:36 AM
Dmitry Chernyshov
Dmitry Chernyshov - avatar