Fix MT project-cache file access compatibility - #14871
Open
JanProvaznik wants to merge 2 commits into
Open
JanProvaznik wants to merge 2 commits into
JanProvaznik wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 85b185e7-08c7-4a95-aa04-d674ec05a321
Member
Author
|
/review |
JanProvaznik
marked this pull request as ready for review
September 8, 2026 15:35
JanProvaznik
temporarily deployed
to
copilot-pat-pool
September 8, 2026 15:35 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It changes wire protocol/versioning and TaskHost/engine execution behavior in a broad, compatibility-sensitive area that warrants final human review.
Pull request overview
This PR improves compatibility and correctness of file-access reporting when tasks execute in out-of-proc TaskHosts, especially under experimental multi-threaded (-mt) builds, while preserving backward-compatible TaskHost packet behavior.
Changes:
- Fixes
FileAccessDataround-tripping by avoiding struct boxing during TaskHost completion packet deserialization. - Propagates and gates
ReportFileAccessesacross TaskHost configuration + replay, and rejects-mtcombined with-reportFileAccesses(CLI +BuildManager). - Updates protocol versioning, resources/localization, unit tests, and multithreading spec documentation accordingly.
File summaries
| File | Description |
|---|---|
| src/Shared/TaskHostTaskComplete.cs | Fix struct translation to preserve FileAccessData through deserialization. |
| src/Shared/TaskHostConfiguration.cs | Add versioned ReportFileAccesses flag to TaskHost configuration packet. |
| src/MSBuild/XMake.cs | Reject incompatible -mt + -reportFileAccesses at command-line parsing. |
| src/MSBuild/TaskExecutionContext.cs | Add per-task file-access collection gated by configuration. |
| src/MSBuild/OutOfProcTaskHostNode.cs | Collect file accesses per task execution context and serialize per-task results. |
| src/MSBuild/Resources/Strings.resx | Add MSB1073 message for incompatible switch combination. |
| src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.tr.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.ru.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.pt-BR.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.pl.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.ko.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.ja.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.it.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.fr.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.es.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.de.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild/Resources/xlf/Strings.cs.xlf | Localized resource entry for MSB1073 (new string). |
| src/MSBuild.UnitTests/XMake_Tests.cs | Add CLI and TaskHost behavior regression coverage (incompatibility + file access transport). |
| src/Framework/BackEnd/NodePacketTypeExtensions.cs | Bump packet version and define min version for new TaskHostConfiguration field. |
| src/Build/Instance/TaskFactories/TaskHostTask.cs | Propagate ReportFileAccesses into TaskHost config; gate replay on build parameters. |
| src/Build/BackEnd/BuildManager/BuildParameters.cs | Document incompatibility between MultiThreaded and ReportFileAccesses. |
| src/Build/BackEnd/BuildManager/BuildManager.cs | Reject incompatible combination for programmatic callers at BeginBuild. |
| src/Build/Resources/Strings.resx | Add engine-level error string for incompatible configuration. |
| src/Build/Resources/xlf/Strings.zh-Hant.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.zh-Hans.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.tr.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.ru.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.pt-BR.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.pl.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.ko.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.ja.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.it.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.fr.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.es.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.de.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build/Resources/xlf/Strings.cs.xlf | Localized resource entry for engine-level incompatible configuration (new string). |
| src/Build.UnitTests/BackEnd/TaskHostTaskComplete_Tests.cs | Add regression test ensuring FileAccessData round-trips correctly. |
| src/Build.UnitTests/BackEnd/TaskHostFactory_Tests.cs | Add regression tests for TaskHost gating + replay logic. |
| src/Build.UnitTests/BackEnd/TaskHostConfiguration_Tests.cs | Add regression tests for protocol-version-gated ReportFileAccesses. |
| src/Build.UnitTests/BackEnd/BuildManager_Tests.cs | Add regression test for programmatic incompatibility rejection pre-build. |
| documentation/specs/multithreading/multithreaded-msbuild.md | Document /reportfileaccesses incompatibility with current MT implementation. |
Review details
- Files reviewed: 43/43 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
dfederm
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14824
Fixes #14825
Fixes #14826
Summary
FileAccessDatavalues across TaskHost deserialization without changing the existing payload format.ReportFileAccessesto TaskHost with packet-version compatibility, gate collection and replay, and keep reported accesses isolated per task execution context.-mttogether with-reportFileAccessesusing actionableMSB1073; programmaticBuildManagercallers receive the equivalent validation.Compatibility
Project-cache lookup/materialization remains compatible with MT. Only Detours-based cache population is rejected because concurrent projects in one process cannot be attributed correctly. CLR2, CLR4, and negotiated .NET TaskHost packet formats retain compatible behavior.
Validation