Vscode: Debug Console window cannot accept Console.ReadLine() input during debugging

Created on 17 Dec 2016  路  6Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.8.0
  • OS Version: Win10 x64

Steps to Reproduce:

  1. Create a new .net core cli app using "dotnet new"
  2. Open the folder using VS code
  3. Add two lines of code in Program.cs
    string a = Console.ReadLine();
    Console.WriteLine(a);
  4. Switch to VS code debug window and start debugging
  5. Debug Console window shows, and displays the first "Hello, World." output, and stops on the line of Console.ReadLine(), enter anything in the Debug Console and press Enter will be given err message of "Unable to perform this action because the process is running."
    untitled
debug debug-console

Most helpful comment

The debug console is output only. The input field you see is for inspecting the environment available at a given stack frame. In your launch config you can specify what console your program should use. Set the console property to externalTerminal. internalTerminal should work as well.

All 6 comments

The debug console is output only. The input field you see is for inspecting the environment available at a given stack frame. In your launch config you can specify what console your program should use. Set the console property to externalTerminal. internalTerminal should work as well.

@weinand I think we should look for a way to make more explicit that the input field is inspection only.

@kieferrm thank you for your reply, below is my launch.json file and I didn't find a property called console, only externalConsole, when it's set to true the keyboard input can be accepted but a new console opened for the debugging, I cannot find internalTerminal configuration option. I tried to switch to the Integrated Terminal while the app waits for the keyboard input but it's the command line there waiting for a command.

Anyway I still wonder if I can debug the app within the Visual Studio Code UI while making Console.ReadLine() to work correctly.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.1\\hwapp.dll",
            "args": [],
            "cwd": "${workspaceRoot}",
            "externalConsole": false,
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnFirstSessionStart"
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command.pickProcess}"
        }
    ]
}

If you can get a modified launch.json to solve my problem that will be great.

@LiangZugeng you are using the coreCLR debugger. I'll move this issue to the corresponding repository.

This issue was moved to OmniSharp/omnisharp-vscode#1053

Properties>Application>Output type Select into ComboBox "Console Application"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisdias picture chrisdias  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments

vsccarl picture vsccarl  路  3Comments

lukehoban picture lukehoban  路  3Comments