Skip to content

[NativeAOT] Use trimmable typemap in PublishAot debug builds#12147

Open
simonrozsival wants to merge 2 commits into
mainfrom
dev/simonrozsival/publishaot-trimmable-typemap-default
Open

[NativeAOT] Use trimmable typemap in PublishAot debug builds#12147
simonrozsival wants to merge 2 commits into
mainfrom
dev/simonrozsival/publishaot-trimmable-typemap-default

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Goal

Default the trimmable typemap from $(PublishAot) rather than the resolved Android runtime, so CoreCLR Debug builds of NativeAOT projects exercise the same typemap path as NativeAOT release builds.

This is a follow-up to #12121, which made the trimmable typemap the default for the NativeAOT runtime.

Contributes to #10794, #11012, #8724, #10788, and #10793.

Change map

  • Microsoft.Android.Sdk.DefaultProperties.targets — select trimmable when $(PublishAot)=true, while preserving explicit typemap overrides and the llvm-ir fallback.
  • Microsoft.Android.Sdk.NativeAOT.targets — remove the now-redundant runtime-specific typemap default.
  • TrimmableTypeMapBuildTests — add a CoreCLR Debug regression test for a project with PublishAot=true.

Local validation

  • MSBuild property evaluation confirmed:
    • PublishAot=true + CoreCLR defaults to trimmable.
    • CoreCLR without PublishAot defaults to llvm-ir.
    • Explicit typemap overrides remain unchanged.
  • The full build test was not run locally because the local Android SDK build is not available.

simonrozsival and others added 2 commits July 17, 2026 11:42
Select the typemap default from PublishAot instead of the resolved Android runtime so CoreCLR Debug builds of NativeAOT projects exercise the trimmable path. Preserve explicit typemap overrides and add a regression test.\n\nFollow-up to #12121.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 4f9c5a7e-e73b-4cc2-8c1d-05c29795c5a4
Document why the typemap default must be selected from PublishAot
instead of the resolved Android runtime.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4f9c5a7e-e73b-4cc2-8c1d-05c29795c5a4
Copilot AI review requested due to automatic review settings July 17, 2026 09:43

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

Updates the MSBuild default selection logic so that projects using PublishAot=true default to the trimmable typemap even when the resolved runtime is CoreCLR (notably Debug builds), ensuring NativeAOT projects exercise the same typemap path across configurations.

Changes:

  • Default _AndroidTypeMapImplementation to trimmable when $(PublishAot)=true, while keeping explicit overrides intact and retaining llvm-ir as the general fallback.
  • Remove the now-redundant NativeAOT-specific default for _AndroidTypeMapImplementation.
  • Add a regression test covering CoreCLR Debug builds with PublishAot=true to ensure the trimmable typemap outputs are produced.
Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets Switches typemap defaulting to be driven by PublishAot (trimmable) with llvm-ir fallback.
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets Removes the NativeAOT-only typemap default since it’s now handled in shared defaults.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/TrimmableTypeMapBuildTests.cs Adds coverage verifying CoreCLR Debug + PublishAot=true uses the trimmable typemap outputs.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants