'Microsoft Visual Studio stuck in debugging mode

Whenever I run my code I am given an error messaging (error msg below) saying It is stuck in debug mode, and the console does not give me a string message for the option I selected.

I have looked for the "enable visual studio" check box other forums have suggested but there isn't one in debug> options. I have not changed any settings so I'm not sure why it's stuck doing this now.

This is the message that shows up in the command prompt

C:\Users\bob\Desktop\csharp\WhileIterationStatement\bin\Debug\netcoreapp3.1\WhileIterationStatement.exe (process 15644) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

I have a while iteration statement,

Console.WriteLine("Choose an option:");
Console.WriteLine("1) Option 1");
Console.WriteLine("2) Option 2");
Console.WriteLine("3) Exit");
string result = Console.ReadLine();
if (result == "1")

and so on and so forth. It should ask for user input, but it just does nothing.



Solution 1:[1]

If you want to ask for user input, you can refer to the following code:

static void Main(string[] args)
    {
        Console.WriteLine("Choose an option:"); 
        Console.WriteLine("1) Option 1"); 
        Console.WriteLine("2) Option 2"); 
        Console.WriteLine("3) Exit"); 
        while (true)
        {
            string keyChoice = Console.ReadLine();
            switch (keyChoice)
            {
                case "0":
                    Console.Clear();
                    Console.WriteLine("Choose an option:");
                    Console.WriteLine("1) Option 1");
                    Console.WriteLine("2) Option 2");
                    Console.WriteLine("3) Exit");
                    continue;
                case "1":
                    //To do
                    Console.Clear();
                    Console.WriteLine("Choose Option 1");
                    Console.WriteLine("Pass '0' To Return To The Main Menu");
                    continue;

                case "2":
                    //To do
                    Console.Clear();
                    Console.WriteLine("Choose Option 2");
                    Console.WriteLine("Pass '0' To Return To The Main Menu");

                    continue;

                case "3":
                    return;
            }
        }
    }

Here is a screenshot of my test, I hope it is useful for you. enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jingmiao Xu-MSFT