dotnet / dotnet/vscode-csharp

Ctrl+C not recognized in Debugging Console and csharp.debug.console is ignored

Open
#7,882 0 comments 2 reactions 0 assignees View on GitHub
Debugger untriaged
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

## Steps to reproduce
1. Create new web app with `dotnet new blazor`
2. Create launch.json
```json
{
"version": "0.2.0",
"configurations": [

{
"type": "dotnet",
"request": "launch",
"name": "Launch Edge against localhost",
"projectPath":"${workspaceFolder}/myapp.csproj"
}
]
}
```

3. Create settings.json
```
{
"csharp.debug.console": "externalTerminal"
}
```

4. Debug the app, but an external terminal does not pop open.
5. The message tells the user to press Ctrl+C but this doesn't work in debug console.

```
Microsoft.Hosting.Lifetime: Information: Now listening on: https://localhost:7059
Microsoft.Hosting.Lifetime: Information: Now listening on: http://localhost:5000
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Content root path: C:\src\myapp
```
## Expected behavior
It's expected to be able to pop open a terminal with `"csharp.debug.console": "externalTerminal"`

## Actual behavior
csharp.debug.console is ignored

## Additional context
Traditional Visual Studio and base C# vscode extension allow opening external terminal, so it's a surprise behavior that this setting is silently ignored. All dotnet apps are _technically_ console apps.

Workaround since the extension code matches on sdk string: https://github.com/microsoft/vscode-dotnettools/issues/1473

The code changes to get this working are here https://github.com/dotnet/vscode-csharp/pull/7878 and I note that browser auto-open continues to function.

This is basically a duplicate of this ticket https://github.com/dotnet/vscode-csharp/issues/7165

I have a real world project where Ctrl+C is relevant because my console app uses the web sdk and launches additional processes, and I needed a way to debug Ctrl+C, SIGINT, X button, etc, in order to debug child process termination behavior.

Suggested change to documentation is to say `the app's console` in place of `console projects`.

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.