dotnet / dotnet/msbuild

Terminal logger inserts newlines into messages

Open
#11,028 0 comments 0 reactions 0 assignees View on GitHub
Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

The new terminal logger inserts newlines and some whitespace padding into longer messages, such as exception from unit tests or "package downgrade detected" build errors to match the terminal window width. This causes two problems (for me):

* Copying text from terminal now contains these additional characters, making it harder to paste file paths into other commands/editor or comparing long strings in other software.
* I'd run `dotnet test` in a narrow terminal window to see how it's going and then enlarge it to read the errors. That workflow now doesn't work.

Workaround is to disable terminal logger using `--tl:off` option or `MSBUILDTERMINALLOGGER=off` env variable. That, however, looses all the other nice features of the logger.

### Steps to Reproduce

Run `dotnet test` or `dotnet build` in project where long enough messages will be printed (such as stacktrace with filenames).

Then either copy-paste some text which was long enough to be line-broken, or run it a narrow window and then enlarge it.

### Expected Behavior

* Text reflows after the window resized (even when dotnet is not running anymore).
* Copied file paths, exception messages, assert values, etc do not contain any additional characters.

-> Line breaks are not inserted into message, or there is a (documented) option to disable it. I don't know of a terminal emulator which can't break text, so I think it should be disabled by default.

### Actual Behavior

Line breaks and additional whitespace characters are inserted into exception messages, stack traces and other messages.

### Analysis

_No response_

### Versions & Configurations

```
> dotnet msbuild -version
17.12.7.52203

> dotnet --info

.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.c6f19616
MSBuild version: 17.12.7+5b8665660

Runtime Environment:
OS Name: arch
OS Version:
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:
6.0.135 [/usr/share/dotnet/sdk]
7.0.120 [/usr/share/dotnet/sdk]
8.0.110 [/usr/share/dotnet/sdk]
9.0.100 [/usr/share/dotnet/sdk]

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

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/usr/share/dotnet]

global.json file:
Not found

> uname -a
Linux hostname 6.6.62-1-lts #1 SMP PREEMPT_DYNAMIC Sun, 17 Nov 2024 16:35:16 +0000 x86_64 GNU/Linux
```

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.