Skip to content

[vs18.3] Fix MSB1025 error when using DistributedFileLogger (-dfl flag)#13040

Merged
YuliiaKovalova merged 5 commits intovs18.3from
backport/pr-13036-to-vs18.3
Jan 19, 2026
Merged

[vs18.3] Fix MSB1025 error when using DistributedFileLogger (-dfl flag)#13040
YuliiaKovalova merged 5 commits intovs18.3from
backport/pr-13036-to-vs18.3

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Jan 16, 2026

Backport of #13036 to vs18.3

Context

When running msbuild -dfl (distributed file logger), MSBuild crashes with:

MSBUILD : error MSB1025: System.ArgumentNullException: Parameter "logger" cannot be null.
   at Microsoft.Build.Evaluation.ProjectCollection.RegisterLoggerInternal(ILogger logger)
   at Microsoft.Build.Evaluation.ProjectCollection.RegisterLoggers(IEnumerable`1 loggers)
   ...

PR #12095 introduced a change that passes all DistributedLoggerRecord.CentralLogger instances to ProjectCollection for evaluation logging. However, the distributed file logger (-dfl) intentionally has a null CentralLogger because it writes separate log files per node and doesn't need central aggregation.

The code now blindly includes these null loggers, which fails the null check in RegisterLoggerInternal().

Changes Made

Filter out null central loggers before passing them to ProjectCollection:

ILogger[] evaluationLoggers =
    [
        .. loggers,
        .. distributedLoggerRecords
            .Select(d => d.CentralLogger)
            .OfType<ILogger>()  // filters out nulls
    ];

Regression

Yes, this is a regression introduced by PR #12095. The -dfl switch worked correctly in MSBuild 17.x.

Risks

No risks, minimal well-boxed change. The fix simply filters out null values that should never have been passed to the logger registration in the first place.

Testing

  • Unit test: Add test case for msbuild -dfl scenario
  • Manual: Verified msbuild -dfl on a simple .NET Framework console solution

Notes

The distributed file logger is a valid configuration where CentralLogger is null by design - each worker node writes to its own log file independently, so no central aggregation logger is needed.

Copilot AI and others added 3 commits January 16, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants