Skip to content

Account for dual compatibility in AssetTargetFallback calculation - fix LockFileBuilderCache conflicts#7433

Merged
nkolev92 merged 2 commits into
devfrom
dev-nkolev92-13326
Jun 2, 2026
Merged

Account for dual compatibility in AssetTargetFallback calculation - fix LockFileBuilderCache conflicts#7433
nkolev92 merged 2 commits into
devfrom
dev-nkolev92-13326

Conversation

@nkolev92
Copy link
Copy Markdown
Member

@nkolev92 nkolev92 commented May 29, 2026

Bug

Fixes: NuGet/Home#13326

Description

During solution restore, all projects share a LockFileBuilderCache. The selection criteria cache (_criteriaSets) is keyed by CriteriaKey, which compares AssetTargetFallbackFramework instances using Equals/GetHashCode.

The problem: AssetTargetFallbackFramework.Equals/GetHashCode only compared base framework properties and the fallback list. It did not account for the RootFramework being a DualCompatibilityFramework (used by C++/CLI projects to add native as a secondary framework).

This meant ATF(DCF(net6.0-windows7.0, native), [net461]) and ATF(net6.0-windows7.0, [net461]) hashed and compared as equal. When the managed project restored first, its criteria (without native) got cached, and the C++/CLI project reused those wrong criteria — so build/native/ targets were never matched.

Fix: Include DualCompatibilityFramework's secondary framework in AssetTargetFallbackFramework.GetHashCode() and Equals(), so the two produce distinct cache keys.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@nkolev92 nkolev92 marked this pull request as ready for review June 1, 2026 18:33
@nkolev92 nkolev92 requested a review from a team as a code owner June 1, 2026 18:33
@nkolev92 nkolev92 requested review from jeffkl and martinrrm June 1, 2026 18:33
@nkolev92 nkolev92 merged commit 391e586 into dev Jun 2, 2026
17 of 18 checks passed
@nkolev92 nkolev92 deleted the dev-nkolev92-13326 branch June 2, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent restore results based on restore order

2 participants