dotnet / dotnet/vscode-csharp

Feature request: Support integrated terminal with remote debugging

Open
#4,779 1 comment 1 reaction 0 assignees View on GitHub
Debugger Feature Request OmniSharp
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

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](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
```csharp
while(!Console.KeyAvailable)
{

}
```
4. Run the remote debugging
5. You'll retrieve an error for Console.KeyAvailable in integratedTerminal
![image](https://user-images.githubusercontent.com/118657/134043246-d437be3d-3521-4d4d-9caa-95531d6961bf.png)

## 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](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](https://user-images.githubusercontent.com/118657/134043246-d437be3d-3521-4d4d-9caa-95531d6961bf.png)

**launch.json**

```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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.