Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ivdiazsa opened this issue Mar 28, 2024 · 3 comments · Fixed by #10144
Closed

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

ivdiazsa opened this issue Mar 28, 2024 · 3 comments · Fixed by #10144
Assignees
Labels
Area: Terminal Logger Problems with the livelogger/fancylogger/terminallogger -tl functionality. bug Priority:2 Work that is important, but not critical for the release triaged

Comments

@ivdiazsa
Copy link
Member

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
@ivdiazsa ivdiazsa added the bug label Mar 28, 2024
@baronfel
Copy link
Member

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?

@ivdiazsa
Copy link
Member Author

ivdiazsa commented Mar 28, 2024

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

@AR-May AR-May added Area: Terminal Logger Problems with the livelogger/fancylogger/terminallogger -tl functionality. Priority:2 Work that is important, but not critical for the release triaged labels Apr 2, 2024
@AR-May AR-May self-assigned this Apr 3, 2024
@AR-May
Copy link
Member

AR-May commented Apr 9, 2024

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

Yes, eterm is listed there and actually "eterm-color" is an acceptable terminal type because of that. Which is probably not quite correct detection: this type only recognizes the ANSI codes that control coloring, and not the ones that moves cursor, for example (checked it in the Emacs Terminal). And it seems to me that both our projects need moves of the cursor.

Overall, I think we need to improve our detection. I see two ways: either we do what Spectre.Console does and have a list of allowed terminal types for the Terminal Logger. Or we obtain the information via parsing the capabilities of a terminal using the terminfo database and comparing them to whatever capabilities we need for Terminal Logger to work. It might be quite tricky to do so though. I found that runtime does something similar.

AR-May added a commit that referenced this issue May 21, 2024
Fixes #9950

Context
Improved detection of ansi support using the "TERM" environment variable.

Changes Made
Added the list of supported terminal types.

Testing
Manual tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Terminal Logger Problems with the livelogger/fancylogger/terminallogger -tl functionality. bug Priority:2 Work that is important, but not critical for the release triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants