Skip to content

[NativeAOT] Let the SDK select runtime packs - #12750

Merged
simonrozsival merged 3 commits into
mainfrom
jonathanpeppers-complete-issue-12362
Sep 11, 2026
Merged

simonrozsival merged 3 commits into
mainfrom
jonathanpeppers-complete-issue-12362

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

The Android RC1 workload stamped its build-time MicrosoftNETCoreAppRefPackageVersion into customer projects and used it to rewrite the .NET SDK's NativeAOT KnownRuntimePack metadata. When the workload was built against 11.0.0-rc.1.26428.117 but installed with the 11.0.100-rc.1.26425.128 SDK, dotnet publish -p:PublishAot=true requested runtime-pack versions that were not available on NuGet.org.

  • Remove the Android-side KnownRuntimePack rewrite now that the .NET SDK advertises android-arm itself.
  • Stop exporting MicrosoftNETCoreAppRefPackageVersion from the Android workload's bundled-version targets.
  • Add restore coverage proving an invalid workload dependency version cannot affect the SDK-selected NativeAOT runtime-pack version.

This keeps runtime-pack and ILCompiler selection owned by the installed .NET SDK and avoids mismatches between independently built SDK and Android workload releases.

Fixes #12362

The .NET SDK now advertises android-arm for NativeAOT runtime packs, so the Android-side KnownRuntimePack rewrite is no longer needed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 10, 2026 14:41

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.

🟢 Approval recommended

The workaround removal matches the updated SDK behavior and existing tests already validate android-arm NativeAOT runtime pack selection during restore.

Pull request overview

Removes the Android-side KnownRuntimePack metadata rewrite for Microsoft.NETCore.App NativeAOT runtime packs, now that the .NET SDK itself advertises android-arm and should provide the correct runtime pack version/RIDs.

Changes:

  • Deleted the KnownRuntimePack override that appended android-arm and forced LatestRuntimeFrameworkVersion.
  • Leaves NativeAOT restore/runtime-pack selection to the pinned .NET SDK (per issue #12362).
File summaries
File Description
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets Removes the KnownRuntimePack rewrite so restore/runtime-pack selection is SDK-driven.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Do not stamp MicrosoftNETCoreAppRefPackageVersion into the Android workload. Add restore coverage proving that NativeAOT runtime pack selection remains owned by the installed .NET SDK.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers changed the title [NativeAOT] Remove runtime pack override [NativeAOT] Let the SDK select runtime packs Sep 10, 2026
Runtime packs are represented in project.assets.json as framework download dependencies, not library keys. Assert the selected versions from the correct section.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Sep 10, 2026
@simonrozsival
simonrozsival merged commit 381b445 into main Sep 11, 2026
44 checks passed
@simonrozsival
simonrozsival deleted the jonathanpeppers-complete-issue-12362 branch September 11, 2026 08:28
@filipnavara

Copy link
Copy Markdown
Member

Thanks!

jonpryor added a commit to unoplatform/uno that referenced this pull request Sep 11, 2026
Context: #22745
Context: dotnet/android#12750
Context: f42da04

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true
	dotnet build -c Release -f net11.0-ios -p:UnoTargetFrameworkOverride=net11.0-ios src/SamplesApp/SamplesApp/SamplesApp.csproj

Fix trimmer warning:

  * IL2080:

        src/Uno.UI/UI/Xaml/Documents/UnicodeText.ICU.cs(249,19): error IL2080: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The field '(System.String, System.Type).Item2' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

    which frankly feels like a bug in the trimmer; how did
    `ValueTuple<T1, T2>.Item2` get involved?

Note: Android+NativeAOT *still* fails to build by default, due to a
similar bug as in .NET 11 Preview 7; see also f42da04, e.g.

	Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-rc.1.26428.117)
	  - Found 23 version(s) in nuget.org [ Nearest version: 11.0.0-rc.1.26425.128 ]
	  - Found 0 version(s) in /Users/jon/Downloads/dotnet-sdk-11.0.100-rc.1.26425.128/library-packs

Update the workaround within `Uno.CrossTargetting.targets`, and
cross fingers 🤞 that .NET 11 rc.2 doesn't require this workaround.
jonpryor added a commit to unoplatform/uno that referenced this pull request Sep 14, 2026
Context: #22745
Context: dotnet/android#12750
Context: f42da04

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true
	dotnet build -c Release -f net11.0-ios -p:UnoTargetFrameworkOverride=net11.0-ios src/SamplesApp/SamplesApp/SamplesApp.csproj

Fix trimmer warning:

  * IL2080:

        src/Uno.UI/UI/Xaml/Documents/UnicodeText.ICU.cs(249,19): error IL2080: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The field '(System.String, System.Type).Item2' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

    which frankly feels like a bug in the trimmer; how did
    `ValueTuple<T1, T2>.Item2` get involved?

Note: Android+NativeAOT *still* fails to build by default, due to a
similar bug as in .NET 11 Preview 7; see also f42da04, e.g.

	Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-rc.1.26428.117)
	  - Found 23 version(s) in nuget.org [ Nearest version: 11.0.0-rc.1.26425.128 ]
	  - Found 0 version(s) in /Users/jon/Downloads/dotnet-sdk-11.0.100-rc.1.26425.128/library-packs

Update the workaround within `Uno.CrossTargetting.targets`, and
cross fingers 🤞 that .NET 11 rc.2 doesn't require this workaround.
jonpryor added a commit to unoplatform/uno that referenced this pull request Sep 14, 2026
Context: #22745
Context: dotnet/android#12750
Context: f42da04

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1
	dotnet build -c Release -f net11.0-ios -p:UnoTargetFrameworkOverride=net11.0-ios src/SamplesApp/SamplesApp/SamplesApp.csproj

Note: when updating `_Dotnet.cs`, the `version` value in
`new PackageIdentity(id, version)` must match the *filesystem path*
underneath `packs/Microsoft.NETCore.App.Ref`, and may *not* match the
output of `dotnet --version`.  Check the filesystem!

Fix trimmer warning:

  * IL2080:

        src/Uno.UI/UI/Xaml/Documents/UnicodeText.ICU.cs(249,19): error IL2080: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The field '(System.String, System.Type).Item2' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

    which frankly feels like a bug in the trimmer; how did
    `ValueTuple<T1, T2>.Item2` get involved?

Note: Android+NativeAOT *still* fails to build by default, due to a
similar bug as in .NET 11 Preview 7; see also f42da04, e.g.

	Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-rc.1.26428.117)
	  - Found 23 version(s) in nuget.org [ Nearest version: 11.0.0-rc.1.26425.128 ]
	  - Found 0 version(s) in /Users/jon/Downloads/dotnet-sdk-11.0.100-rc.1.26425.128/library-packs

Update the workaround within `Uno.CrossTargetting.targets`, and
cross fingers 🤞 that .NET 11 rc.2 doesn't require this workaround.
jonpryor added a commit to unoplatform/uno that referenced this pull request Sep 14, 2026
Context: #22745
Context: dotnet/android#12750
Context: dotnet/runtime#133911
Context: f42da04

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1
	dotnet build -c Release -f net11.0-ios -p:UnoTargetFrameworkOverride=net11.0-ios src/SamplesApp/SamplesApp/SamplesApp.csproj

Note: when updating `_Dotnet.cs`, the `version` value in
`new PackageIdentity(id, version)` must match the *filesystem path*
underneath `packs/Microsoft.NETCore.App.Ref`, which *may not* match
the output of `dotnet --version`.  Check the filesystem!

Address an IL2080 trimmer warning:

	// 249: var (methodName, type) = OperatingSystem.IsBrowser() ? ($"uno_{typeof(T).Name}", typeof(BrowserICUSymbols)) : ($"{typeof(T).Name}_{_icuVersion}", typeof(IOSICUSymbols))
	src/Uno.UI/UI/Xaml/Documents/UnicodeText.ICU.cs(249,19): error IL2080: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The field '(System.String, System.Type).Item2' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Filed dotnet/runtime#133911 for the above warning, as it feels wrong.

Note: Android+NativeAOT *still* fails to build by default, due to a
similar bug as in .NET 11 Preview 7; see also f42da04, e.g.

	Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-rc.1.26428.117)
	  - Found 23 version(s) in nuget.org [ Nearest version: 11.0.0-rc.1.26425.128 ]
	  - Found 0 version(s) in /Users/jon/Downloads/dotnet-sdk-11.0.100-rc.1.26425.128/library-packs

Update the workaround within `Uno.CrossTargetting.targets`, and
cross fingers 🤞 that .NET 11 rc.2 doesn't require this workaround.

Update `android-run-skia-runtime-tests.sh` to capture a screenshot of
the device screen as the tests are run, so we can see what is shown
when Android tests hang.
jonpryor added a commit to unoplatform/uno that referenced this pull request Sep 15, 2026
Context: #22745
Context: dotnet/android#12750
Context: dotnet/runtime#133911
Context: f42da04

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1
	dotnet build -c Release -f net11.0-ios -p:UnoTargetFrameworkOverride=net11.0-ios src/SamplesApp/SamplesApp/SamplesApp.csproj

Note: when updating `_Dotnet.cs`, the `version` value in
`new PackageIdentity(id, version)` must match the *filesystem path*
underneath `packs/Microsoft.NETCore.App.Ref`, which *may not* match
the output of `dotnet --version`.  Check the filesystem!

Address an IL2080 trimmer warning:

	// 249: var (methodName, type) = OperatingSystem.IsBrowser() ? ($"uno_{typeof(T).Name}", typeof(BrowserICUSymbols)) : ($"{typeof(T).Name}_{_icuVersion}", typeof(IOSICUSymbols))
	src/Uno.UI/UI/Xaml/Documents/UnicodeText.ICU.cs(249,19): error IL2080: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The field '(System.String, System.Type).Item2' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Filed dotnet/runtime#133911 for the above warning, as it feels wrong.

Note: Android+NativeAOT *still* fails to build by default, due to a
similar bug as in .NET 11 Preview 7; see also f42da04, e.g.

	Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-rc.1.26428.117)
	  - Found 23 version(s) in nuget.org [ Nearest version: 11.0.0-rc.1.26425.128 ]
	  - Found 0 version(s) in /Users/jon/Downloads/dotnet-sdk-11.0.100-rc.1.26425.128/library-packs

Update the workaround within `Uno.CrossTargetting.targets`, and
cross fingers 🤞 that .NET 11 rc.2 doesn't require this workaround.

Update `android-run-skia-runtime-tests.sh` to capture a screenshot of
the device screen as the tests are run, so we can see what is shown
when Android tests hang.
jonpryor added a commit to unoplatform/uno that referenced this pull request Sep 15, 2026
Context: #22745
Context: dotnet/android#12750
Context: dotnet/runtime#133911
Context: f42da04

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true
	dotnet publish -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1
	dotnet build -c Release -f net11.0-ios -p:UnoTargetFrameworkOverride=net11.0-ios src/SamplesApp/SamplesApp/SamplesApp.csproj

Note: when updating `_Dotnet.cs`, the `version` value in
`new PackageIdentity(id, version)` must match the *filesystem path*
underneath `packs/Microsoft.NETCore.App.Ref`, which *may not* match
the output of `dotnet --version`.  Check the filesystem!

Address an IL2080 trimmer warning:

	// 249: var (methodName, type) = OperatingSystem.IsBrowser() ? ($"uno_{typeof(T).Name}", typeof(BrowserICUSymbols)) : ($"{typeof(T).Name}_{_icuVersion}", typeof(IOSICUSymbols))
	src/Uno.UI/UI/Xaml/Documents/UnicodeText.ICU.cs(249,19): error IL2080: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The field '(System.String, System.Type).Item2' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Filed dotnet/runtime#133911 for the above warning, as it feels wrong.

Note: Android+NativeAOT *still* fails to build by default, due to a
similar bug as in .NET 11 Preview 7; see also f42da04, e.g.

	Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-rc.1.26428.117)
	  - Found 23 version(s) in nuget.org [ Nearest version: 11.0.0-rc.1.26425.128 ]
	  - Found 0 version(s) in /Users/jon/Downloads/dotnet-sdk-11.0.100-rc.1.26425.128/library-packs

Update the workaround within `Uno.CrossTargetting.targets`, and
cross fingers 🤞 that .NET 11 rc.2 doesn't require this workaround.

Update `android-run-skia-runtime-tests.sh` to capture a screenshot of
the device screen as the tests are run, so we can see what is shown
when Android tests hang.

Finally, update `android-run-skia-runtime-tests.sh` and
`android-uitest-run.sh` to *stop* installing the `tools` package.
Attempting to install it is now an error:

	% ($ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=/tmp/my-sdk --install 'tools') ; echo exit=$?
	Warning: Failed to find package 'tools'
	[===                                    ] 10% Computing updates...
	exit=1

(The `tools` package was last updated in *2017-September*, has been
deprecarted for quite some time, and is now no longer mentioned in
[`repository2-3.xml`][0], which lists all Android SDK packages.
This removal has been a long time coming…)

[0]: https://dl.google.com/android/repository/repository2-3.xml
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove NativeAOT runtime-pack override after dotnet/sdk#55750 ships

4 participants