Skip to content

Preserve restore no-op for case-equivalent project paths - #7699

Merged
zivkan merged 2 commits into
NuGet:devfrom
vaboca:dev-vaboca-restore-noop-path-casing
Sep 15, 2026
Merged

zivkan merged 2 commits into
NuGet:devfrom
vaboca:dev-vaboca-restore-noop-path-casing

Conversation

@vaboca

@vaboca vaboca commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Bug

Fixes: NuGet/Home#15081

Description

Preserve restore's no-op cache when dependency graphs differ only in project-path casing on case-insensitive platforms. Project identity lookup already uses the OS-dependent path comparer, but hash serialization retained the original spelling, allowing equivalent paths to invalidate the cache across graph evaluations.

Normalize only project/restore identity keys, project paths, project-reference keys and paths, and the derived output path while hashing. The output path is needed because it inherits the project directory's casing; removing its normalization breaks the case-only hash and second-restore regressions. Other restore paths retain their existing hash behavior, and the production diff introduces no LINQ. Normal serialized output and graph objects retain their original spelling. Both FNV and legacy SHA512 use the same normalization.

Added regression coverage for root and referenced-project paths, unchanged serialized output, and continued invalidation for other restore-input changes. Unrelated config, package-cache, fallback, lock-file, runtime-graph, and asset paths are held fixed in the casing reproduction. A Windows local-feed test verifies that changing only the project-directory casing between restores returns NoOpRestoreResult without rewriting the assets file.

Validation on Windows:

  • ProjectModel tests: 1,419 passed and 4 skipped on each of net472 and net10.0.
  • The new two-restore regression and the existing no-op cache test: 2 passed on each target.
  • Solution-wide dotnet format whitespace --verify-no-changes NuGet.sln --no-restore completed successfully with workspace-load warnings; git diff --check passed.
  • Linux and full CI were not run locally.

No public APIs, settings, environment variables, or output schemas are added or changed, so a documentation issue or PR is not applicable.

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.

@vaboca
vaboca requested a review from a team as a code owner September 12, 2026 00:42
@dotnet-policy-service dotnet-policy-service Bot added the Community PRs created by someone not in the NuGet team label Sep 12, 2026
@vaboca

vaboca commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@vaboca please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree company="Microsoft"

@nkolev92
nkolev92 requested a review from zivkan September 14, 2026 15:45
@zivkan
zivkan merged commit ded9f38 into NuGet:dev Sep 15, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Case-only project paths invalidate no-op restore on Windows

3 participants