dotnet / dotnet/msbuild

Figure out ways to work around LazyFormattedBuildEventArgs destructive updates

Open
#14,985 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

## Context

Question: could we hack the log order to push binlogs first? Would that be sufficient? I'd like to avoid redoing the formatting in the multiple-text-logger/TL+text-logger cases if we can . . .

_Originally posted by @rainersigwald in https://github.com/dotnet/msbuild/pull/14914#pullrequestreview-5144766524_

## Explanation

There's a latent issue with the LazyFormattedBuildEventArgs in that calling `.Message` is destructive - it erases knowledge of the underlying format string + arguments.

Ideally we would be able to either remove the probably most common cause of this mutable destruction by making the binlog first/ahead of other loggers that may want the `.Message`, or by fixing the event type to be non-destructive.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating LazyFormattedBuildEventArgs and tracing how Message is consumed by binlog and the multiple-text-logger/TL+text-logger paths. Compare the proposed logger-order workaround with making the event non-destructive; done means selecting and validating an approach that preserves the underlying format string and arguments for all affected loggers.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.