Fix MSB1025 error when using DistributedFileLogger (-dfl flag)#13036
Fix MSB1025 error when using DistributedFileLogger (-dfl flag)#13036YuliiaKovalova merged 2 commits intomainfrom
Conversation
|
Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo. |
|
@copilot try again |
|
@copilot please try again, let's see if I have permissions. |
…logger Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Done! The fix has been implemented in commit dcdf256. The issue was that when using I've also added a regression test |
baronfel
left a comment
There was a problem hiding this comment.
This LGTM, but I have to point out that we would not have shipped this bug if xmake.cs was nullable-enabled.
|
/backport to vs18.0 |
|
Started backporting to |
|
/backport to vs18.3 |
|
Started backporting to |
Updated [Microsoft.Build](https://github.com/dotnet/msbuild) from 18.3.3 to 18.4.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Build's releases](https://github.com/dotnet/msbuild/releases)._ ## 18.4.0 ## What's Changed * Fix terminal logger quiet mode to show project context for warnings/errors by @Copilot in dotnet/msbuild#12930 * Replace OpenTelemetry with Microsoft.VisualStudio.Telemetry for VS by @YuliiaKovalova in dotnet/msbuild#12843 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13050856 by @dotnet-bot in dotnet/msbuild#12982 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#12979 * eliminate test data serialization warnings by @JanProvaznik in dotnet/msbuild#12983 * Add the feature flag that allows users to opt out automatic UTF8 console encoding by @GangWang01 in dotnet/msbuild#12637 * Polyfill clean up and source package organization by @DustinCampbell in dotnet/msbuild#12977 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13052367 by @dotnet-bot in dotnet/msbuild#12984 * Add documentation for enabling binlog collection via env var by @YuliiaKovalova in dotnet/msbuild#12805 * Support multiple binary logs from command line arguments by @Copilot in dotnet/msbuild#12706 * Add VcxprojReader.exe to ngenApplications by @YuliiaKovalova in dotnet/msbuild#12986 * Add HostServices support in Out-of-Process Task Host by @YuliiaKovalova in dotnet/msbuild#12753 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#13002 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#13000 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13078382 by @dotnet-bot in dotnet/msbuild#13003 * Add telemetry tracking for task factory names and runtime usage by @Copilot in dotnet/msbuild#12989 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#12987 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13079827 by @dotnet-bot in dotnet/msbuild#13010 * Snap for VS 18.3 and update branding to VS 18.4 by @Copilot in dotnet/msbuild#13005 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#13012 * Add telemetry to categorize build failure reasons by @Copilot in dotnet/msbuild#13007 * Update MicrosoftBuildVersion in analyzer template by @github-actions[bot] in dotnet/msbuild#13011 * Update OptProf drop metadata configuration by @YuliiaKovalova in dotnet/msbuild#13020 * Fix MSB1025 error when using DistributedFileLogger (-dfl flag) by @Copilot in dotnet/msbuild#13036 * CmdLine parsing was extracted from XMake and the implementation is visible to dotnet (attempt 2) by @MichalPavlik in dotnet/msbuild#12836 * Make task environment path absolutization not throw. by @AR-May in dotnet/msbuild#13035 * Fix flaky test TestTerminalLoggerTogetherWithOtherLoggers by @Copilot in dotnet/msbuild#13044 * Enlighten more tasks that require no change by @AR-May in dotnet/msbuild#13045 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#13050 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#13048 * Add support for MSBUILD_LOGGING_ARGS by @YuliiaKovalova in dotnet/msbuild#12993 * Fix MSBuildEventSource by @dfederm in dotnet/msbuild#13030 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13124182 by @dotnet-bot in dotnet/msbuild#13053 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#13031 * Add incrementality tracking support and more detailed analysis of the build errors reported by @YuliiaKovalova in dotnet/msbuild#13057 * [automated] Merge branch 'vs18.3' => 'main' by @github-actions[bot] in dotnet/msbuild#13055 * Enable com support for clr4 in task host by @YuliiaKovalova in dotnet/msbuild#13033 * Add 'rel/d18.3' to insertion target branch options by @ViktorHofer in dotnet/msbuild#13067 * add OriginalValue property to AbsolutePath by @JanProvaznik in dotnet/msbuild#13077 * [automated] Merge branch 'vs18.3' => 'main' by @github-actions[bot] in dotnet/msbuild#13074 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13137486 by @dotnet-bot in dotnet/msbuild#13075 * Refactor FileUtilities.cs and add methods for absolute paths. by @AR-May in dotnet/msbuild#13079 * Limit extended flag usage to NET and CLR4 runtimes by @YuliiaKovalova in dotnet/msbuild#13080 * [main] Update dependencies from nuget/nuget.client by @dotnet-maestro[bot] in dotnet/msbuild#13065 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13137926 by @dotnet-bot in dotnet/msbuild#13081 * Update to 10.0.1 references by @rainersigwald in dotnet/msbuild#13072 * Undo COM support in out of proc task host CLR4 by @YuliiaKovalova in dotnet/msbuild#13089 * Add Managed Identity for bootstrapper creation by @rainersigwald in dotnet/msbuild#13092 * Add warning MSB4280 when DOTNET_HOST_PATH is set to a directory by @Copilot in dotnet/msbuild#13091 ... (truncated) Commits viewable in [compare view](dotnet/msbuild@v18.3.3...v18.4.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updated [Microsoft.Build.Framework](https://github.com/dotnet/msbuild) from 18.3.3 to 18.4.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Build.Framework's releases](https://github.com/dotnet/msbuild/releases)._ ## 18.4.0 ## What's Changed * Fix terminal logger quiet mode to show project context for warnings/errors by @Copilot in dotnet/msbuild#12930 * Replace OpenTelemetry with Microsoft.VisualStudio.Telemetry for VS by @YuliiaKovalova in dotnet/msbuild#12843 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13050856 by @dotnet-bot in dotnet/msbuild#12982 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#12979 * eliminate test data serialization warnings by @JanProvaznik in dotnet/msbuild#12983 * Add the feature flag that allows users to opt out automatic UTF8 console encoding by @GangWang01 in dotnet/msbuild#12637 * Polyfill clean up and source package organization by @DustinCampbell in dotnet/msbuild#12977 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13052367 by @dotnet-bot in dotnet/msbuild#12984 * Add documentation for enabling binlog collection via env var by @YuliiaKovalova in dotnet/msbuild#12805 * Support multiple binary logs from command line arguments by @Copilot in dotnet/msbuild#12706 * Add VcxprojReader.exe to ngenApplications by @YuliiaKovalova in dotnet/msbuild#12986 * Add HostServices support in Out-of-Process Task Host by @YuliiaKovalova in dotnet/msbuild#12753 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#13002 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#13000 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13078382 by @dotnet-bot in dotnet/msbuild#13003 * Add telemetry tracking for task factory names and runtime usage by @Copilot in dotnet/msbuild#12989 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#12987 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13079827 by @dotnet-bot in dotnet/msbuild#13010 * Snap for VS 18.3 and update branding to VS 18.4 by @Copilot in dotnet/msbuild#13005 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#13012 * Add telemetry to categorize build failure reasons by @Copilot in dotnet/msbuild#13007 * Update MicrosoftBuildVersion in analyzer template by @github-actions[bot] in dotnet/msbuild#13011 * Update OptProf drop metadata configuration by @YuliiaKovalova in dotnet/msbuild#13020 * Fix MSB1025 error when using DistributedFileLogger (-dfl flag) by @Copilot in dotnet/msbuild#13036 * CmdLine parsing was extracted from XMake and the implementation is visible to dotnet (attempt 2) by @MichalPavlik in dotnet/msbuild#12836 * Make task environment path absolutization not throw. by @AR-May in dotnet/msbuild#13035 * Fix flaky test TestTerminalLoggerTogetherWithOtherLoggers by @Copilot in dotnet/msbuild#13044 * Enlighten more tasks that require no change by @AR-May in dotnet/msbuild#13045 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#13050 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#13048 * Add support for MSBUILD_LOGGING_ARGS by @YuliiaKovalova in dotnet/msbuild#12993 * Fix MSBuildEventSource by @dfederm in dotnet/msbuild#13030 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13124182 by @dotnet-bot in dotnet/msbuild#13053 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#13031 * Add incrementality tracking support and more detailed analysis of the build errors reported by @YuliiaKovalova in dotnet/msbuild#13057 * [automated] Merge branch 'vs18.3' => 'main' by @github-actions[bot] in dotnet/msbuild#13055 * Enable com support for clr4 in task host by @YuliiaKovalova in dotnet/msbuild#13033 * Add 'rel/d18.3' to insertion target branch options by @ViktorHofer in dotnet/msbuild#13067 * add OriginalValue property to AbsolutePath by @JanProvaznik in dotnet/msbuild#13077 * [automated] Merge branch 'vs18.3' => 'main' by @github-actions[bot] in dotnet/msbuild#13074 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13137486 by @dotnet-bot in dotnet/msbuild#13075 * Refactor FileUtilities.cs and add methods for absolute paths. by @AR-May in dotnet/msbuild#13079 * Limit extended flag usage to NET and CLR4 runtimes by @YuliiaKovalova in dotnet/msbuild#13080 * [main] Update dependencies from nuget/nuget.client by @dotnet-maestro[bot] in dotnet/msbuild#13065 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13137926 by @dotnet-bot in dotnet/msbuild#13081 * Update to 10.0.1 references by @rainersigwald in dotnet/msbuild#13072 * Undo COM support in out of proc task host CLR4 by @YuliiaKovalova in dotnet/msbuild#13089 * Add Managed Identity for bootstrapper creation by @rainersigwald in dotnet/msbuild#13092 * Add warning MSB4280 when DOTNET_HOST_PATH is set to a directory by @Copilot in dotnet/msbuild#13091 ... (truncated) Commits viewable in [compare view](dotnet/msbuild@v18.3.3...v18.4.0). </details> Updated [Microsoft.Build.Utilities.Core](https://github.com/dotnet/msbuild) from 18.3.3 to 18.4.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Build.Utilities.Core's releases](https://github.com/dotnet/msbuild/releases)._ ## 18.4.0 ## What's Changed * Fix terminal logger quiet mode to show project context for warnings/errors by @Copilot in dotnet/msbuild#12930 * Replace OpenTelemetry with Microsoft.VisualStudio.Telemetry for VS by @YuliiaKovalova in dotnet/msbuild#12843 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13050856 by @dotnet-bot in dotnet/msbuild#12982 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#12979 * eliminate test data serialization warnings by @JanProvaznik in dotnet/msbuild#12983 * Add the feature flag that allows users to opt out automatic UTF8 console encoding by @GangWang01 in dotnet/msbuild#12637 * Polyfill clean up and source package organization by @DustinCampbell in dotnet/msbuild#12977 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13052367 by @dotnet-bot in dotnet/msbuild#12984 * Add documentation for enabling binlog collection via env var by @YuliiaKovalova in dotnet/msbuild#12805 * Support multiple binary logs from command line arguments by @Copilot in dotnet/msbuild#12706 * Add VcxprojReader.exe to ngenApplications by @YuliiaKovalova in dotnet/msbuild#12986 * Add HostServices support in Out-of-Process Task Host by @YuliiaKovalova in dotnet/msbuild#12753 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#13002 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#13000 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13078382 by @dotnet-bot in dotnet/msbuild#13003 * Add telemetry tracking for task factory names and runtime usage by @Copilot in dotnet/msbuild#12989 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#12987 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13079827 by @dotnet-bot in dotnet/msbuild#13010 * Snap for VS 18.3 and update branding to VS 18.4 by @Copilot in dotnet/msbuild#13005 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#13012 * Add telemetry to categorize build failure reasons by @Copilot in dotnet/msbuild#13007 * Update MicrosoftBuildVersion in analyzer template by @github-actions[bot] in dotnet/msbuild#13011 * Update OptProf drop metadata configuration by @YuliiaKovalova in dotnet/msbuild#13020 * Fix MSB1025 error when using DistributedFileLogger (-dfl flag) by @Copilot in dotnet/msbuild#13036 * CmdLine parsing was extracted from XMake and the implementation is visible to dotnet (attempt 2) by @MichalPavlik in dotnet/msbuild#12836 * Make task environment path absolutization not throw. by @AR-May in dotnet/msbuild#13035 * Fix flaky test TestTerminalLoggerTogetherWithOtherLoggers by @Copilot in dotnet/msbuild#13044 * Enlighten more tasks that require no change by @AR-May in dotnet/msbuild#13045 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#13050 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#13048 * Add support for MSBUILD_LOGGING_ARGS by @YuliiaKovalova in dotnet/msbuild#12993 * Fix MSBuildEventSource by @dfederm in dotnet/msbuild#13030 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13124182 by @dotnet-bot in dotnet/msbuild#13053 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#13031 * Add incrementality tracking support and more detailed analysis of the build errors reported by @YuliiaKovalova in dotnet/msbuild#13057 * [automated] Merge branch 'vs18.3' => 'main' by @github-actions[bot] in dotnet/msbuild#13055 * Enable com support for clr4 in task host by @YuliiaKovalova in dotnet/msbuild#13033 * Add 'rel/d18.3' to insertion target branch options by @ViktorHofer in dotnet/msbuild#13067 * add OriginalValue property to AbsolutePath by @JanProvaznik in dotnet/msbuild#13077 * [automated] Merge branch 'vs18.3' => 'main' by @github-actions[bot] in dotnet/msbuild#13074 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13137486 by @dotnet-bot in dotnet/msbuild#13075 * Refactor FileUtilities.cs and add methods for absolute paths. by @AR-May in dotnet/msbuild#13079 * Limit extended flag usage to NET and CLR4 runtimes by @YuliiaKovalova in dotnet/msbuild#13080 * [main] Update dependencies from nuget/nuget.client by @dotnet-maestro[bot] in dotnet/msbuild#13065 * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 13137926 by @dotnet-bot in dotnet/msbuild#13081 * Update to 10.0.1 references by @rainersigwald in dotnet/msbuild#13072 * Undo COM support in out of proc task host CLR4 by @YuliiaKovalova in dotnet/msbuild#13089 * Add Managed Identity for bootstrapper creation by @rainersigwald in dotnet/msbuild#13092 * Add warning MSB4280 when DOTNET_HOST_PATH is set to a directory by @Copilot in dotnet/msbuild#13091 ... (truncated) Commits viewable in [compare view](dotnet/msbuild@v18.3.3...v18.4.0). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Summary
Fixes the MSB1025 ArgumentNullException error that occurs when using the
-dfl(distributed file logger) flag with MSBuild 18. The issue was introduced in PR #12095 where distributed logger central loggers were passed to ProjectCollection without filtering out null values.Customer Impact
Users running
msbuild -dflon MSBuild 18/VS 2026 encounter a blocking error:This prevents builds from running when using the distributed file logger, which is commonly used for multi-node build logging. The
-dflflag worked correctly in MSBuild 17 and earlier versions.Root Cause: When using
-dfl, the DistributedLoggerRecord intentionally has a null CentralLogger (as documented in XMake.cs line 4298-4299). PR #12095 introduced code that includes these central loggers in the evaluationLoggers array without filtering nulls, causing ProjectCollection.RegisterLoggerInternal() to throw ArgumentNullException.Regression?
Testing
Code Changes:
.Where(l => l is not null)to filter out null central loggers from the evaluationLoggers arrayTestNullCentralLoggerInDistributedLoggerRecordto verify DistributedLoggerRecords with null CentralLogger don't cause exceptionsVerification:
TestNullCentralLoggerInDistributedLoggerRecordpassesmsbuild simple.proj -dfl -t:Buildnow works correctly and creates distributed log fileRisk
Low - This is a minimal, surgical fix that:
Original prompt
This section details on the original issue you should resolve
<issue_title>MsBuild 18/VS 2026 MSB1025 error when using DistributedFileLogger - The 'logger' parameter cannot be null.</issue_title>
<issue_description>### Issue Description
When running
msbuild -dfli receive such errorMSBUILD : error MSB1025: podczas uruchamiania programu MSBuild wystąpił błąd wewnętrzny. System.ArgumentNullException: Parametr „logger” nie może być zerowy. w Microsoft.Build.Shared.ErrorUtilities.ThrowArgumentNull(String parameterName, String resourceName) w Microsoft.Build.Evaluation.ProjectCollection.RegisterLoggerInternal(ILogger logger) w Microsoft.Build.Evaluation.ProjectCollection.RegisterLoggers(IEnumerable1 loggers)w Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary
2 globalProperties, IEnumerable1 loggers, IEnumerable1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents, Boolean loadProjectsReadOnly, Boolean useAsynchronousLogging, Boolean reuseProjectRootElementCache, Boolean enableTargetOutputLogging) w Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary2 globalProperties, Dictionary2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Boolean needToValidateProject, String schemaFile, Int32 cpuCount, Boolean multiThreaded, Boolean enableNodeReuse, TextWriter preprocessWriter, TextWriter targetsWriter, Boolean detailedSummary, ISet1 warningsAsErrors, ISet1 warningsNotAsErrors, ISet1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, ProjectIsolationMode isolateProjects, GraphBuildOptions graphBuildOptions, Boolean lowPriority, Boolean question, Boolean isTaskAndTargetItemLoggingRequired, Boolean isBuildCheckEnabled, String[] inputResultsCaches, String outputResultsCache, Boolean saveProjectResult, BuildResult& result, Boolean reportFileAccesses, String commandLine)w Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)`
Steps to Reproduce
to reproduce i create simple .net framework console solution and i run
msbuild -dflin solution directoryExpected Behavior
Solution should build as in previous version of msbuild (17)
Actual Behavior
Blocking error
MSBUILD : error MSB1025: podczas uruchamiania programu MSBuild wystąpił błąd wewnętrzny. System.ArgumentNullException: Parametr „logger” nie może być zerowy.Analysis
I tried to find any information in documentation about breaking changes in DistributedFileLogger but with no success.
Trying different fileLoggerParameters did not help
Switching to fileLogger works as expected
Versions & Configurations
Wersja programu MSBuild 18.0.5+e22287bf1 dla .NET Framework
18.0.5.56406
ran from C:\Program Files\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin\amd64\MSBuild.rsp
and
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.rsp
Windows 11 </issue_description>
<agent_instructions>Yes, this bug is very likely caused by the change in PR #12095.
Here's the problematic code introduced in src/MSBuild/XMake.cs:
csharpILogger[] evaluationLoggers =
[
// all of the loggers that are single-node only
.. loggers,
// all of the central loggers for multi-node systems. These need to be resilient to multiple calls
// to Initialize
.. distributedLoggerRecords.Select(d => d.CentralLogger)
];
projectCollection = new ProjectCollection(
globalProperties,
evaluationLoggers, // <-- now includes distributed logger central loggers
...
The problem: When you use -dfl (distributed file logger), the DistributedLoggerRecord.CentralLogger can be null. The code now blindly passes all CentralLogger values into the ProjectCollection constructor without filtering out nulls.
When ProjectCollection.RegisterLoggers() iterates over these loggers and calls RegisterLoggerInternal(), it hits:
csharpprivate void RegisterLoggerInternal(ILogger logger)
{
ErrorUtilities.VerifyThrowArgumentNull(logger); // <-- throws here when logger is null
...
}
The fix should filter out null loggers:
csharpILogger[] evaluationLoggers =
[
.. loggers,
.. distributedLoggerRecords
.Select(d => d.CentralLogger)
.Where(l => l != null) // <-- add this filter
];</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@YuliiaKovalova Hi @kkapuscinski ,Thank you for reporting the issue! It's likely to connected to #12095 change.
We are working on the fix.
cc: @baronfel </comment_new>
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.