Lack of reading input from console .net-core application in vscode

I am trying to get a dotnet new console sample project (for vscode) to work on Ubuntu 17.10.

I can run the program by default:

using System;

namespace dotnet_console
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello world!");
        }
    }
}

But when I change it to read input, it becomes really awkward ...

using System;

namespace dotnet_console
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Name: "); // 1
            var name = Console.ReadLine(); // 2
            Console.WriteLine("Hello {0}!", name); // 3
        }
    }
}

The program builds, but does not print Name:. However, if I set breakpoints on lines 1, 2, and 3, I see that the program goes through ALL of them, but doesn't print anything. This is until I stop debugging. Then he prints

Name:

The program '[16322] dotnet-console.dll' exited with code 0 (0x0).

What's going on here? I assume this is vscode because it works as expected when running from the terminal using dotnet run.

+4
2

:

(stdout/stderr), VS Code Debugger. , , .. , (: Console.ReadLine). ,

.

, launch.json " externalTerminal" " integratedTerminal" .

externalTerminal, .

integerTerminal, VS Code. "" , .

Launch.json location

+4

Source: https://habr.com/ru/post/1693459/


All Articles