Skip to content

Feature request: Support integrated terminal with remote debugging #4779

@ikivanc

Description

@ikivanc

I want to use Console.KeyAvailable in my C# code using remote debugger with VS Code. I set up launch.json with
following the documentation for Console (terminal) window:
https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window however I retrieve an error, but same code is working properly with a standalone run through command prompt.

Steps to Reproduce:

  1. Create a C# .net core application for .NET Core IoT
  2. Add integratedTerminal in launch.json for remote debugging (Copy launch.json as an example)
  3. Add line in Main
while(!Console.KeyAvailable)
{

}
  1. Run the remote debugging
  2. You'll retrieve an error for Console.KeyAvailable in integratedTerminal
    image

Expected behavior

I want to use Console.KeyAvailable value in my C# code using remote debugger with VS Code.

Actual behavior

Console.KeyAvailable breaks in the debugging mode, however it works fine with C# console app through command prompt.
It seems like, Console.KeyAvailable has same issue with Console.ReadLine() mentioned in the documentation to not use with internalConsole in launch.json, https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window

To solve this I used integratedTerminal and 'externalTerminal', but it seems like it's not supported in VSCode console.

Error:
image

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Remote Launch",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "publish",
            "program": "/opt/dotnet/dotnet",
            "args": ["/home/pi/DNSensorAzureIoTHub/DNSensorAzureIoTHub.dll"],
            "cwd": "~/DNSensorAzureIoTHub",
            "stopAtEntry": false,
            "console": "integratedTerminal",
            "pipeTransport": {
                "pipeCwd": "${workspaceFolder}\\dotnet-iot",
                "pipeProgram": "ssh",
                "pipeArgs": [
                    "pi@192.168.1.46"
                ],
                "debuggerPath": "~/vsdbg/vsdbg"
                }
            }]
}

Environment data

.NET SDK (reflecting any global.json):
Version: 6.0.100-rc.1.21458.32
Commit: d7c22323c4

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\

Host (useful for support):
Version: 6.0.0-rc.1.21451.13
Commit: d7619cd4b1

.NET SDKs installed:
3.1.413 [C:\Program Files\dotnet\sdk]
5.0.207 [C:\Program Files\dotnet\sdk]
5.0.400 [C:\Program Files\dotnet\sdk]
6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk]

VS Code version: 1.60.1
C# Extension version: 1.23.15

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions