Skip to content

[build] Do not modify assemblies in the NuGet package cache - #12450

Merged
jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-test-nuget-cache-resources
Aug 20, 2026
Merged

[build] Do not modify assemblies in the NuGet package cache#12450
jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-test-nuget-cache-resources

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Aug 19, 2026

Copy link
Copy Markdown
Member

Description

Android builds must treat the NuGet global package cache as read-only. However, satellite *.resources.dll files from NuGet packages were included in ResolvedAssemblies and passed to AssemblyModifierPipeline using their original package-cache paths.

When marshal methods were enabled, _RunAfterILLinkAdditionalSteps ran this pipeline in place. Even unchanged assemblies had their timestamps updated, and concurrent builds could fail when they attempted to write the same cached file.

Exclude satellite resource assemblies from the post-link modifier input only when the pipeline operates in place. The assemblies remain in the normal resolved-assembly flow, so they are still packaged, and non-in-place post-link processing is unchanged.

Add a regression test using Humanizer.Core.es from the public dotnet-public feed. It locks the package's resource assemblies and verifies that the build neither writes to them nor changes their timestamps.

Tests

  • BuildDoesNotModifyNuGetPackageCache
  • CheckIncludedAssemblies(True, CoreCLR)

Fixes #11022

Add a red regression test for #11022 using Humanizer satellite assemblies from dotnet-public.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d50a004c-7088-4372-a35a-a824c74118be
Skip satellite resource assemblies when the post-link pipeline operates in place, while retaining them in the packaging item flow.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d50a004c-7088-4372-a35a-a824c74118be
@jonathanpeppers jonathanpeppers changed the title [tests] Reproduce NuGet package cache modification [build] Avoid modifying NuGet satellite assemblies Aug 19, 2026
@jonathanpeppers
jonathanpeppers marked this pull request as ready for review August 19, 2026 19:44
Copilot AI lite review requested due to automatic review settings August 19, 2026 19:44
@jonathanpeppers jonathanpeppers changed the title [build] Avoid modifying NuGet satellite assemblies [build] Do not modify assemblies in the NuGet package cache Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents Android builds from mutating *.resources.dll satellite assemblies located in the NuGet global package cache when the post-link AssemblyModifierPipeline runs in-place (marshal-methods path), avoiding timestamp changes and potential concurrent-build file lock collisions.

Changes:

  • Filters @(ResolvedAssemblies) so satellite *.resources.dll are excluded only from the in-place post-link modifier inputs.
  • Keeps satellite assemblies in the normal assembly flow so they can still be packaged as expected.
  • Adds a regression test that restores Humanizer satellite assemblies, locks them, and verifies they aren’t modified by the build.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets Excludes *.resources.dll from the in-place AssemblyModifierPipeline input list to avoid writing into NuGet package-cache paths.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs Adds a regression test intended to ensure builds don’t modify locked NuGet satellite assemblies.

Comment thread src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Delete the incremental post-link stamp before exercising the marshal-method path and verify that the target recreates it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d50a004c-7088-4372-a35a-a824c74118be
@jonathanpeppers
jonathanpeppers merged commit 66d3f74 into main Aug 20, 2026
44 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-test-nuget-cache-resources branch August 20, 2026 14:00
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.

XAAMP7024 - Build error due to IOException in AssemblyModifierPipeline

3 participants