Preserve direct inner-build edges in static graph#14395
Open
AlesProkop wants to merge 1 commit into
Open
Conversation
Preserve explicit inner-build references when outer-build expansion produces the same graph edge, and merge their target requirements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bd403e09-8890-421f-ab7c-83eaac6d05b1
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes static graph construction for multi-targeting scenarios where a project references both an outer build and a specific inner build directly, ensuring explicit ProjectReference edges aren’t incorrectly treated as “must be transitive” and removed during outer-build expansion.
Changes:
- Updates
ProjectInterpretation.AddInnerBuildEdgesto preserve explicitProjectReferenceedges to inner builds while continuing to replace_TransitiveProjectReferenceedges. - Keeps a defensive assertion for unexpected edge item types when an inner-build edge already exists.
- Adds a parameterized unit test validating edge preservation, target-metadata merging, and resulting target lists across several
Targetsmetadata combinations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Build/Graph/ProjectInterpretation.cs | Adjusts inner-build edge expansion logic to keep explicit inner-build ProjectReference edges and only remove/replace transitive ones. |
| src/Build.UnitTests/Graph/ProjectGraph_Tests.cs | Adds coverage for preserving direct inner-build references when outer-build expansion generates the same edge, including target list behavior. |
AlesProkop
force-pushed
the
alesprokop/fix-static-graph-direct-inner-reference
branch
from
July 20, 2026 14:00
c9d9250 to
f7ab99b
Compare
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 #14325
Context
Static graph construction failed when a project referenced both a multitargeted project's outer build and one of its generated inner builds directly.
ProjectInterpretation.AddInnerBuildEdgesassumed an existing inner-build edge could only be transitive, even when it came from an explicitProjectReference.Changes Made
ProjectReferenceedge when outer-build expansion reaches the same inner-build node._TransitiveProjectReferenceedges and validation for unexpected edge types.Targetsmetadata.Testing
DirectInnerBuildReferenceIsPreservedWhenOuterBuildGeneratesTheSameEdgeonnet10.0— 4 passed, 0 failed.MSB0001: Only transitive references may reference inner builds that got generated by outer buildserror.The general fix that surfaces critical graph-build exceptions instead of hanging is split into #14461.