Repository navigation
Conversation
… build request In a graph build, MSBuild's ProjectCacheService initializes the plugin with the graph in the background (InitializePluginsForGraph is fire-and-forget), while the scheduler already submits the first nodes. When a node's cache query gets there first, the plugin gets no graph, one entry point per project of the solution, and that node's targets as the build's targets. Its graph then lacks the solution's ProjectDependencies edges and puts these targets on every project: weak fingerprints differ, lookups miss, and outer builds are never added because MSBuild reports fewer targets than expected. Seen with MSBuild 18.8 on a loaded CI runner, as 16-19 % hit ratios. Detect it (no graph, entry points carrying IsGraphBuild=true), rebuild the graph from the SolutionPath global property with the solution configuration that maps the projects as the build does, and use the "Build" targets. Keep the rebuilt graph only if one of its nodes gets exactly the requesting node's targets; otherwise keep the entry point graph. Both outcomes are logged at high importance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
12 tasks
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.
In a graph build,
ProjectCacheServiceinitializes project cache plugins with the graph in the background (InitializePluginsForGraphis not awaited), while the scheduler already submits the first nodes. When a node's cache query gets there first, MSBuild initializes the plugin from that build request instead.BeginBuildAsyncthen gets noGraph, one entry point per project of the solution, and that node's targets asRequestedTargets.The plugin builds its graph from those entry points, which has two consequences:
ProjectDependenciesedges;Weak fingerprints differ from the ones the same build would compute with the real graph, so lookups miss. Outer builds of multi-targeting projects are never added either, since MSBuild reports fewer targets than the plugin expects. We saw it with MSBuild 18.8 on a loaded CI runner, as hit ratios of 16–19 % on builds that otherwise get 100 %.
The fix belongs in MSBuild: dotnet/msbuild#15514 registers the plugins before a graph build submits its nodes. Until builds run on an MSBuild with that fix, this change works around it in the plugin:
Graph, and entry points that carryIsGraphBuild=true(the global property MSBuild sets on graph build requests).SolutionPathglobal property, with the solution configuration that maps the projects the way the build does, and use the solution build'sBuildtargets.The workaround can be removed once the supported MSBuild versions include the fix.
Tests:
GraphBuildRequestInitializationTestscovers the detection, the solution entry point (path and solution configuration), and the target list check, for a graph and a non-graph initialization.🤖 Generated with Claude Code