Add EnumeratePattern and OpenedFileOrDirectoryAttributes to FileAccessData - #14104
Merged
jankratochvilcz merged 2 commits intoJul 21, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends MSBuild’s public experimental Microsoft.Build.Experimental.FileAccess.FileAccessData to forward two additional fields from BuildXL detours reports—EnumeratePattern and OpenedFileOrDirectoryAttributes—so downstream consumers (notably MSBuildCache enumeration fingerprinting) can avoid over-broad directory enumeration and extra filesystem probes.
Changes:
- Added
EnumeratePatternandOpenedFileOrDirectoryAttributestoFileAccessData(new overload + translation support). - Mapped the new fields from BuildXL detours listener payload in
DetouredNodeLauncher. - Updated BuildXL and frozen maintenance-package versions to match the newer BuildXL dependency closure, plus added unit tests for translation round-trips.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Directory.Build.targets | Advances frozen maintenance-package versions and updates compile-reference paths used for net472 builds. |
| src/Build/FileAccess/FileAccessData.cs | Adds the two new fields/properties and serializes them via ITranslatable; keeps legacy ctor as an overload. |
| src/Build/BackEnd/Components/Communications/DetouredNodeLauncher.cs | Forwards EnumeratePattern and OpenedFileOrDirectoryAttributes from BuildXL detours into MSBuild’s FileAccessData. |
| src/Build.UnitTests/FileAccess/FileAccessData_Tests.cs | Adds translation round-trip coverage for the new fields (including null pattern). |
| eng/dependabot/Directory.Packages.props | Bumps Microsoft.BuildXL.Processes to the first version exposing EnumeratePattern on the listener payload. |
dfederm
force-pushed
the
dfederm/msbuild-fileaccessdata-add-detours-fields
branch
2 times, most recently
from
June 18, 2026 21:26
aea4cca to
967e6b9
Compare
rainersigwald
approved these changes
Jun 18, 2026
JanProvaznik
approved these changes
Jun 19, 2026
AlesProkop
enabled auto-merge (squash)
June 23, 2026 12:41
This was referenced Jun 24, 2026
ViktorHofer
pushed a commit
that referenced
this pull request
Jun 29, 2026
Quarantines 5 flaky tests detected by the automated flaky-test detector across `main` rolling builds and approved PRs. All failures are confined to Windows legs (`FullOnWindows`, `FullOnWindows Release`, `CoreOnWindows`) with `net472` TFM, so each is scoped with `TestPlatforms.Windows`. --- ## 1. `CoordinatorServer_Tests.ConcurrentClients_AllReceiveGrants` **Flaky-test key** (automated de-duplication — do not edit): ```text flaky-test-id: Microsoft.Build.Coordinator.UnitTests.CoordinatorServer_Tests.ConcurrentClients_AllReceiveGrants ``` **Action:** Quarantine (6a) Tracked by #14193 - **Distinct sources:** 7 (3 PRs + 4 rolling `main` builds) - **PRs:** #14104, #14130, #14135 - **Rolling builds:** [1472231](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1472231), [1472331](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1472331), [1477803](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1477803), [1478840](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1478840) - **Legs:** CoreOnWindows, FullOnWindows, FullOnWindows Release | **TFM:** net472 - **First seen:** 2026-06-19 | **Last seen:** 2026-06-24 - **Sample error:** `System.IO.IOException: The semaphore timeout period has expired.` --- ## 2. `MSBuildServer_Tests.CanShutdownServerProcess` **Flaky-test key** (automated de-duplication — do not edit): ```text flaky-test-id: Microsoft.Build.Engine.UnitTests.MSBuildServer_Tests.CanShutdownServerProcess ``` **Action:** Quarantine (6a) Tracked by #14195 - **Distinct sources:** 3 (rolling `main` builds only) - **Rolling builds:** [1464065](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1464065), [1475010](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1475010), [1481906](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1481906) - **Legs:** FullOnWindows, FullOnWindows Release | **TFM:** net472 - **First seen:** 2026-06-15 | **Last seen:** 2026-06-25 - **Error hashes:** 4 distinct signatures - **Sample error:** `System.InvalidOperationException: Couldn't get process information from performance counter.` --- ## 3. `XMakeAppTests.GetCommandLine` **Flaky-test key** (automated de-duplication — do not edit): ```text flaky-test-id: Microsoft.Build.UnitTests.XMakeAppTests.GetCommandLine ``` **Action:** Quarantine (6a) Tracked by #14194 - **Distinct sources:** 3 (rolling `main` builds only) - **Rolling builds:** [1464065](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1464065), [1475010](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1475010), [1481906](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1481906) - **Legs:** FullOnWindows, FullOnWindows Release | **TFM:** net472 - **First seen:** 2026-06-15 | **Last seen:** 2026-06-25 - **Error hashes:** 4 distinct signatures - **Sample error:** command-line path assertion mismatch on Windows (`ShouldContain` failure for `MSBuild.exe /v:diag` path) --- ## 4. `XMakeAppTests.GetCommandLineQuotedExe` **Flaky-test key** (automated de-duplication — do not edit): ```text flaky-test-id: Microsoft.Build.UnitTests.XMakeAppTests.GetCommandLineQuotedExe ``` **Action:** Quarantine (6a) Tracked by #14192 - **Distinct sources:** 3 (rolling `main` builds only) - **Rolling builds:** [1464065](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1464065), [1475010](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1475010), [1481906](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1481906) - **Legs:** FullOnWindows, FullOnWindows Release | **TFM:** net472 - **First seen:** 2026-06-15 | **Last seen:** 2026-06-25 - **Error hashes:** 4 distinct signatures - **Sample error:** command-line path assertion mismatch on Windows (`ShouldContain` failure for `MSBuild.exe /v:diag` path) --- ## 5. `XMakeAppTests.GetCommandLineQuotedExeOnPath` **Flaky-test key** (automated de-duplication — do not edit): ```text flaky-test-id: Microsoft.Build.UnitTests.XMakeAppTests.GetCommandLineQuotedExeOnPath ``` **Action:** Quarantine (6a) Tracked by #14196 - **Distinct sources:** 3 (rolling `main` builds only) - **Rolling builds:** [1464065](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1464065), [1475010](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1475010), [1481906](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1481906) - **Legs:** FullOnWindows, FullOnWindows Release | **TFM:** net472 - **First seen:** 2026-06-15 | **Last seen:** 2026-06-25 - **Error hashes:** 4 distinct signatures - **Sample error:** command-line path assertion mismatch on Windows (`ShouldContain` failure for `MSBuild.exe /v:diag` path) > Generated by [Flaky Test Triage](https://github.com/dotnet/msbuild/actions/runs/28321861359) · 610.5 AIC · ⊞ 34.9K · [◷](https://github.com/search?q=repo%3Adotnet%2Fmsbuild+%22gh-aw-workflow-id%3A+flaky-test-detector.agent%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Flaky Test Triage, engine: copilot, version: 1.0.60, model: claude-sonnet-4.6, id: 28321861359, workflow_id: flaky-test-detector.agent, run: https://github.com/dotnet/msbuild/actions/runs/28321861359 --> <!-- gh-aw-workflow-id: flaky-test-detector.agent --> <!-- gh-aw-workflow-call-id: dotnet/msbuild/flaky-test-detector.agent --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sData Surface two BuildXL detours fields that MSBuild previously dropped when forwarding file-access reports: EnumeratePattern (the directory-enumeration search pattern, e.g. *.cs) and OpenedFileOrDirectoryAttributes (kernel-resolved attributes, distinct from the caller-requested FlagsAndAttributes). Consumers such as MSBuildCache need these for enumeration fingerprinting. Bump Microsoft.BuildXL.Processes to 0.1.0-20260612.4, the first package exposing EnumeratePattern on the listener struct. Its net472 assemblies reference newer maintenance packages (System.Memory, etc.) than we deliberately compile against, so RAR emits a benign MSB3277 unification conflict; we keep compiling against the frozen versions (preserving best-effort compatibility for older MSBuildLocator consumers) and demote the conflict to a message, since we ship and binding-redirect to the newer versions at runtime.
auto-merge was automatically disabled
July 13, 2026 18:39
Head branch was pushed to by a user without write access
dfederm
force-pushed
the
dfederm/msbuild-fileaccessdata-add-detours-fields
branch
from
July 13, 2026 18:39
c82ef06 to
1a43bfb
Compare
Contributor
Author
|
Sorry for the force-push. Only change since last iteration is the change to |
JanProvaznik
approved these changes
Jul 13, 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.
Summary
BuildXL's detours sandbox captures rich per-file-access data, but MSBuild's public
FileAccessDatastruct (Microsoft.Build.Experimental.FileAccess) dropped two of those fields when forwarding reports to consumers. This adds them:EnumeratePattern(string?) - the search pattern passed to a directory-enumeration API (e.g. thelpFileNameargument toFindFirstFileEx, such as*.cs).nullfor accesses that are not directory enumerations.OpenedFileOrDirectoryAttributes(FlagsAndAttributes) - the actual attributes of the opened file/directory as resolved by the kernel, distinct from the existingFlagsAndAttributeswhich reflects what the caller requested.Why
The immediate consumer is MSBuildCache's enumeration fingerprinting. Without
EnumeratePattern, a cache lookup must conservatively re-enumerate the entire directory and compare against the build-time member list; any file that did not match the original pattern (e.g.*.dll,obj/, an.editorconfignext to a*.csenumeration) appears "new" at lookup and forces a cache miss - effectively never getting hits on common filtered enumerations.OpenedFileOrDirectoryAttributeslets consumers classify whether a probe hit a file or a directory without an extra filesystem round-trip.Changes
FileAccessData(properties, translation, and a new constructor; the existing constructor is kept as an overload to preserve binary compatibility).DetouredNodeLauncher.Microsoft.BuildXL.Processesto0.1.0-20260612.4- the first package version that exposesEnumeratePatternonIDetoursEventListener.FileAccessData(it previously existed only on the end-of-processReportedFileAccess).MSB3277 suppression
The newer BuildXL package's net472 assemblies reference newer maintenance packages (
System.Memory,System.Threading.*, etc.) than MSBuild deliberately compiles against. MSBuild freezes its net472 compile references to older versions so that older API consumers (e.g. apps locating MSBuild via MSBuildLocator that ship their own olderSystem.Memory/System.Collections.Immutable) keep working best-effort; at runtime we ship and binding-redirect to the latest. The BuildXL transitive makes RAR emitMSB3277because it can't unify down to the frozen version. Since none of the BuildXL API we consume exposes the newer types (the two new fields are astringand an enum), this conflict is benign - the runtime redirect resolves it - so it's demoted to a message (scoped to the projects that use the frozen versions) rather than bumping the frozen versions and raising the floor for those older consumers.Not included
Other BuildXL-only fields were intentionally not added -
CreationDisposition,Usn(requires manifest opt-in),ShareMode,Status,Method,ExplicitlyReported,ManifestPath,RawError- as they are diagnostic or sandbox-policy details not useful to MSBuild consumers.Testing
FileAccessDatatranslation round-trip tests cover both new fields (including the null-pattern case). A producer-side assertion that an enumeration access yieldsEnumeratePattern == "*.cs"is left as a follow-up: there is no end-to-end detours test harness in the repo today (it requires Windows/net472 BuildXL detours).