dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

Home Page:https://docs.microsoft.com/visualstudio/msbuild/msbuild

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: New Terminal Logger Prints Progress Poorly Formatted in Some Terminals

ivdiazsa opened this issue · comments

Issue Description

The newest version of .NET 9 implements a new console logger, which displays build status in a more "real-time" format by overwriting the progress line. This looks great, however, it does not work properly in some specific terminals, like for example the Emacs Terminal (not Emacs Shell).

Steps to Reproduce

In the terminals that don't like the new logger, building any dotnet app reproduces the issue. I'm using this command for mine: dotnet build -c Release -o out

It is worth mentioning that we can get around this issue by passing the flag -tl:false to the dotnet command.

Expected Behavior

Displays only one line of progress in a clean format:

Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  TestApp succeeded (1.9s) → out/TestApp.dll

Build succeeded in 2.6s

Actual Behavior

In said terminals, the carriage return seems to be getting messed up and the output looks like this:

�]9;4;3;�\







  csproj                                                                                                          (0.0s)

                                                                                                                  (0.0s)

                                                                                                                  (0.1s)

                                                                                                                  (0.1s)

                                                                                                                  (0.2s)

                                                                                                                  (0.2s)

                                                                                                                  (0.2s)

                                                                                                                  (0.3s)

                                                                                                                  (0.3s)

                                                                                                                  (0.3s)

                                                                                                                  (0.4s)

                                                                                                                  (0.4s)

                                                                                                                  (0.4s)

                                                                                                                  (0.5s)

Restore complete (0.5s)

  csproj                                                                                                          (0.5s)

                                                                                                                  (0.5s)

You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy

  TestApp                                                                              ProcessFrameworkReferences (0.0s)


  TestApp                                                                            ResolveOffByDefaultAnalyzers (0.1s)

  TestApp                                                                    FindReferenceAssembliesForReferences (0.1s)

  TestApp                                                                                CoreGenerateAssemblyInfo (0.1s)

  TestApp                                                                                             CoreCompile (0.2s)

                                                                                                                  (0.2s)

                                                                                                                  (0.2s)

  TestApp                                                                                          _CreateAppHost (0.3s)

                                                                                                                  (0.3s)

                                                                                                                  (0.3s)

                                                                                                                  (0.4s)

  TestApp                                                                                           GetTargetPath (0.4s)

  TestApp                                                                  GenerateBuildRuntimeConfigurationFiles (0.4s)

  TestApp succeeded (0.4s) → �]8;;file:///media/ivdiazsa/DataDrive/Development/for-experiments/AssemblyReflection/TestApp/out�\out/TestApp.dll�]8;;�\


Build succeeded in 1.2s
�]9;4;0;�\

Analysis

No response

Versions & Configurations

This is my dotnet installation (output of dotnet --info):

.NET SDK:
 Version:           9.0.100-preview.2.24157.14
 Commit:            f7466905f9
 Workload version:  9.0.100-manifests.04914b26
 MSBuild version:   17.10.0-preview-24127-03+6f44380e4

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/ivdiazsa/dotnet/sdk/9.0.100-preview.2.24157.14/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      9.0.0-preview.2.24128.5
  Architecture: x64
  Commit:       8e5e748c5c

.NET SDKs installed:
  6.0.420 [/home/ivdiazsa/dotnet/sdk]
  7.0.407 [/home/ivdiazsa/dotnet/sdk]
  8.0.202 [/home/ivdiazsa/dotnet/sdk]
  9.0.100-preview.2.24157.14 [/home/ivdiazsa/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.28 [/home/ivdiazsa/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.17 [/home/ivdiazsa/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.3 [/home/ivdiazsa/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0-preview.2.24128.4 [/home/ivdiazsa/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.28 [/home/ivdiazsa/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.17 [/home/ivdiazsa/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.3 [/home/ivdiazsa/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0-preview.2.24128.5 [/home/ivdiazsa/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/home/ivdiazsa/dotnet]

global.json file:
  Not found

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

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

Looks like we're just checking if TERM isn't dumb - Spectre.Console has a series of expected TERM values that they use for probing - should we use that to align more?

Looks like we're just checking if TERM isn't dumb - Spectre.Console has a series of expected TERM values that they use for probing - should we use that to align more?

Interesting, you do have eterm listed there. I wonder if eterm-color is treated as a completely different one.

Adding for more information:

echo $TERM
eterm-color