Skip to content

Skip test-runtime install on cross-architecture builds - #55460

Merged
nagilson merged 3 commits into
dotnet:mainfrom
nagilson:nagilson-fix-arm64-native-test-runtimes
Jul 27, 2026
Merged

nagilson merged 3 commits into
dotnet:mainfrom
nagilson:nagilson-fix-arm64-native-test-runtimes

Conversation

@nagilson

Copy link
Copy Markdown
Member

Summary

On cross-build CI legs (e.g. x64 host building for arm64), the restore scripts install target-architecture runtimes into the host .dotnet folder. This causes libhostpolicy load failures when the NuGet credential provider resolves a shared framework built for the wrong CPU architecture, breaking dotnet tool restore.

Fix

Skip installing test runtimes entirely when TARGET_ARCHITECTURE differs from the host architecture (since the built product won't run on the build machine anyway). Preserves the macOS Rosetta 2 exception where x64 binaries can run on arm64.

Port of the fix from release/dnup (PR #55435 by @dsplaisted) to main.

Fixes #55457

On cross-build CI legs (e.g. x64 host building for arm64), the restore
scripts were installing target-architecture runtimes into the host
.dotnet folder. This caused libhostpolicy load failures when the NuGet
credential provider tried to resolve a shared framework built for the
wrong CPU architecture, breaking dotnet tool restore.

Skip installing test runtimes entirely when the target architecture
differs from the host (since the built product won't run on the build
machine anyway). Preserve the macOS Rosetta 2 exception where x64
binaries can run on arm64.

Port of the fix from release/dnup (PR dotnet#55435) to main.

Fixes dotnet#55457

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 18:06
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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 updates the SDK toolset restore scripts to avoid installing test shared frameworks into the repo-local .dotnet when the build is cross-architecture (host arch != TARGET_ARCHITECTURE). This prevents mixed-architecture shared frameworks in .dotnet, which can break dotnet tool restore (notably via NuGet credential provider plugin load failures).

Changes:

  • Skip installing test runtimes when TARGET_ARCHITECTURE differs from the host architecture (with a macOS/Rosetta exception in the bash script).
  • Simplify the PowerShell flow by removing the “fallback architecture” helper and gating runtime install behind a single installTestRuntimes check.

Reviewed changes

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

File Description
eng/restore-toolset.sh Skips test-runtime installation on cross-arch legs, with a Rosetta 2 exception intended to keep installing when x64 can run on arm64.
eng/restore-toolset.ps1 Skips test-runtime installation when TARGET_ARCHITECTURE differs from the native architecture and removes the fallback-architecture helper.

Comment thread eng/restore-toolset.sh Resolved
nagilson and others added 2 commits July 24, 2026 11:47
The only macOS cross-build leg (osx-x64 Official on arm64 host) has
runTests: false, so the test runtimes are never used even if installed.
Simplify by uniformly skipping test-runtime install on all cross-builds.

Co-authored-by: Copilot <[email protected]>
@dsplaisted

Copy link
Copy Markdown
Member

@nagilson It turns out that the runtimes that are downloaded get copied to the helix test images and are necessary there. So I added a commit that downloads them to a separate folder when there's a host / target architecture mismatch, and then OverlaySdkOnLKG.targets copies them from there to the test .NET root.

@nagilson
nagilson enabled auto-merge July 27, 2026 18:07

@nagilson nagilson left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Approved, new change LGTM but I can't approve because it's my PR. Need another approver @marcpopMSFT ?

@nagilson
nagilson merged commit da2d405 into dotnet:main Jul 27, 2026
28 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 28, 2026
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.

Official CI arm64 jobs failing with CredentialProvider.Microsoft.dll plugin startup errors

4 participants