You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET 11 RC2 MAUI app fails to compile (NativeAOT) with MAUI Community Toolkit #13143
The following exception occurs at build time (after clean bin/obj folders) when trying to publish an Android application with NativeAOT turned on. macOS/iOS build and run NativeAOT fine.
obj\Release\net11.0-android\typemap\java\scrc64243bbae2d1378c01\BoundServiceBinder.java:24: error: package scrc64d4e0e3a6d812f4d7 does not exist
public BoundServiceBinder (scrc64d4e0e3a6d812f4d7.MediaControlsService p0)
^
obj\Release\net11.0-android\typemap\java\scrc64243bbae2d1378c01\BoundServiceBinder.java:32: error: package scrc64d4e0e3a6d812f4d7 does not exist
private native void nctor_2 (scrc64d4e0e3a6d812f4d7.MediaControlsService p0);
^
2 errors
3 warnings
changed the title [-].NET 11 RC2 MAUI app fails to compile with MAUI Community Toolkit[/-][+].NET 11 RC2 MAUI app fails to compile (NativeAOT) with MAUI Community Toolkit[/+]on Oct 14, 2026
Reproduced locally with a minimal .NET 11 Android NativeAOT app, without MAUI or CommunityToolkit dependencies.
The root cause is inconsistent Java-name resolution in the trimmable typemap scanner. MediaControlsService declares [Service(Name = "communityToolkit.maui.media.services")], and its Java wrapper is generated with that explicit name. However, when resolving the service type for BoundServiceBinder’s constructor signature, JavaPeerScanner.GetJniObjectDescriptor checks [Register] and then falls back to an autogenerated CRC64 name, ignoring the component attribute’s explicit Name.
Consequently, both the generated Java constructor and its nctor_2 native declaration reference a class that was never generated, producing the two reported javac errors. This is a naming mismatch, not the service being removed by trimming or a missing Java dependency. The same gap exists in current main.
The fix is to consult the indexed component attribute’s JNI name after [Register] and before the CRC64 fallback, matching wrapper generation’s precedence. I am implementing that correction with regression coverage for named components in constructor and exported object/array signatures. An isolated corrected scanner generates wrappers that compile with javac; full rebuilt-SDK validation is still in progress.
As a workaround, publishing the minimal app with PublishAot=false succeeds. Adding [Register] matching the service’s configured Java name also allows its NativeAOT publish to succeed, but applying that workaround to the Toolkit service would require changing/rebuilding Toolkit.
Activity
[-].NET 11 RC2 MAUI app fails to compile with MAUI Community Toolkit[/-][+].NET 11 RC2 MAUI app fails to compile (NativeAOT) with MAUI Community Toolkit[/+]simonrozsival commentedon Oct 14, 2026
Reproduced locally with a minimal .NET 11 Android NativeAOT app, without MAUI or CommunityToolkit dependencies.
The root cause is inconsistent Java-name resolution in the trimmable typemap scanner.
MediaControlsServicedeclares[Service(Name = "communityToolkit.maui.media.services")], and its Java wrapper is generated with that explicit name. However, when resolving the service type forBoundServiceBinder’s constructor signature,JavaPeerScanner.GetJniObjectDescriptorchecks[Register]and then falls back to an autogenerated CRC64 name, ignoring the component attribute’s explicitName.Consequently, both the generated Java constructor and its
nctor_2native declaration reference a class that was never generated, producing the two reported javac errors. This is a naming mismatch, not the service being removed by trimming or a missing Java dependency. The same gap exists in current main.The fix is to consult the indexed component attribute’s JNI name after
[Register]and before the CRC64 fallback, matching wrapper generation’s precedence. I am implementing that correction with regression coverage for named components in constructor and exported object/array signatures. An isolated corrected scanner generates wrappers that compile with javac; full rebuilt-SDK validation is still in progress.As a workaround, publishing the minimal app with
PublishAot=falsesucceeds. Adding[Register]matching the service’s configured Java name also allows its NativeAOT publish to succeed, but applying that workaround to the Toolkit service would require changing/rebuilding Toolkit.[tests] Exercise component JNI names through Android builds
[Microsoft.Android.Sdk.TrimmableTypeMap] Honor component JNI names (#…
[tests] Add trimming regression tests for past bugs
[tests] Add trimming regression tests for past bugs
[tests] Add trimming regression tests for past bugs
[tests] Add trimming regression tests for past bugs