Skip to content

[build] Use trimmable typemaps when PublishAot is enabled - #12419

Merged
jonathanpeppers merged 5 commits into
mainfrom
dev/simonrozsival/public-aot-debug
Aug 19, 2026
Merged

jonathanpeppers merged 5 commits into
mainfrom
dev/simonrozsival/public-aot-debug

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #12406

Summary

  • Default AndroidTypeMapImplementation to trimmable when PublishAot is true.
  • Document the PublishAot-based typemap default.

Explicit AndroidTypeMapImplementation values remain unchanged.

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

Copilot-Session: ecfa1706-25e7-415f-a03e-af27f65164fc
Copilot AI lite review requested due to automatic review settings August 18, 2026 14:35
Remove the broader runtime-selection changes and make PublishAot alone select the trimmable typemap implementation.

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

Copilot-Session: ecfa1706-25e7-415f-a03e-af27f65164fc

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

Aligns .NET for Android’s PublishAot=true behavior with the .NET SDK: Debug builds keep AOT analyzers/trimming settings but run on CoreCLR, while Release builds and publish operations continue to use NativeAOT. It also updates the default typemap selection to match the runtime choice and ensures per-RID inner builds receive the relevant native-compilation setting.

Changes:

  • Update runtime selection so PublishAot=true chooses NativeAOT only for Release or publish builds; Debug uses CoreCLR.
  • Change default AndroidTypeMapImplementation defaults (CoreCLR/NativeAOT → trimmable, MonoVM → llvm-ir) and add a Debug PublishAot test.
  • Propagate NativeCompilationDuringPublish into the per-RID inner build and document the updated runtime/typemap behavior.
Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/TrimmableTypeMapBuildTests.cs Updates typemap default test and adds a Debug PublishAot behavior test.
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets Adjusts _AndroidRuntime selection logic and runtime-based typemap defaults; sets NativeCompilationDuringPublish for Debug PublishAot.
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets Forwards NativeCompilationDuringPublish into per-RID inner builds via AdditionalProperties.
Documentation/docs-mobile/building-apps/build-properties.md Updates docs for typemap defaults and UseMonoRuntime vs PublishAot runtime selection behavior.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

@simonrozsival simonrozsival changed the title [build] Use CoreCLR for Debug PublishAot builds [build] Use trimmable typemaps when PublishAot is enabled Aug 18, 2026
@simonrozsival simonrozsival reopened this Aug 18, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ecfa1706-25e7-415f-a03e-af27f65164fc
Keep NativeCompilationDuringPublish disabled for CoreCLR inner-loop builds and cover the PublishAot Debug trimmable typemap path.

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

Copilot-Session: ce335541-30db-4fd1-8799-24078022b70c
Remove the unrelated CoreCLR NativeCompilationDuringPublish default and set it only in the regression test so the test covers typemap selection without invoking ILC.

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

Copilot-Session: ce335541-30db-4fd1-8799-24078022b70c
@simonrozsival

Copy link
Copy Markdown
Member Author

GetObjectArray test failed:

Expected existing Context peer, got Android.AppTests.App.
Expected: same as [scrc64fa896a7733fc58da.App@41314db](mailto:scrc64fa896a7733fc58da.App@41314db)
But was:  [scrc64fa896a7733fc58da.App@41314db](mailto:scrc64fa896a7733fc58da.App@41314db)

I think this must be a flaky test/intermittent bug that's in main and it's very likely not caused by this PR.

@simonrozsival

Copy link
Copy Markdown
Member Author

GetObjectArray passed on a rerun

@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 19, 2026
@jonathanpeppers
jonathanpeppers merged commit cb9eeef into main Aug 19, 2026
44 checks passed
@jonathanpeppers
jonathanpeppers deleted the dev/simonrozsival/public-aot-debug branch August 19, 2026 14:05
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 19, 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). trimmable-type-map

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PublicAot=true for debug mode

3 participants