dotnet / dotnet/sdk

unexpected control chracter output from dotnet run

Open
#45,002 4 comments 0 reactions 1 assignee Claimed by @baronfel View on GitHub
untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
Unexpected ASCII control characters are inserted in output when running "dotnet run" for a console project.

### To Reproduce
```
docker run --rm -it mcr.microsoft.com/dotnet/sdk:9.0 bash
mkdir hello
cd hello
dotnet new console
dotnet run
apt update && apt install less
dotnet run | less
```

expected result:
less shows "Hello, World!"

actual result:
less shows: "ESC]9;4;3;ESC\ESC]9;4;0;ESC\Hello, World!"

### Further technical details
```root@fc99a2efb5c3:/hello# dotnet --info
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660

Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.100/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4

.NET SDKs installed:
9.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download
```

- The same characters are written when output is redirected to file
- behavior is not reproducible with dotnet 8 sdk
- same behavior can be observed on windows
- with dotnet 9 sdk "dotnet restore" progress output can be observed, which was not observed with dotnet 8 sdk -> possible reason?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.