From c91c34612b2a5ef066f7434cef9ddaf0dcf31560 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 6 Jul 2026 12:44:46 -0500 Subject: [PATCH 1/2] Bump external/Java.Interop from `7049364` to `c24a8e9b` Fixes a Release-mode startup crash in MAUI apps on preview.6: System.TypeInitializationException: ... Java.Interop.ManagedPeer ---> Java.Lang.IncompatibleClassChangeError: no static or non-static method "Lnet/dot/jni/ManagedPeer;.????" Picks up dotnet/java-interop#1474 "Register JNI natives via blittable JniNativeMethod", which reworks the RegisterNatives chokepoint to marshal method names/signatures to UTF-8 ourselves and dispatch through the blittable RegisterNatives(ReadOnlySpan) overload. The old path passed a non-blittable JniNativeMethodRegistration[] through a delegate* unmanaged<> call. dotnet/runtime#126911 moved array-of-struct marshalling into a managed StructureMarshaler whose blittable-only fallback is miscompiled by crossgen2 under composite R2R + startup MIBC, blitting a managed string reference into the native char* name and corrupting the registered method names (the "????" above). This only reproduces in Release (composite R2R + PGO), which is why Debug and `dotnet new android` were unaffected while MAUI Release crashed. Refs: https://github.com/dotnet/android/issues/11633 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- external/Java.Interop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/Java.Interop b/external/Java.Interop index 70493645c7d..c24a8e9b3c2 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit 70493645c7d95648010a4cef948234a28744c03f +Subproject commit c24a8e9b3c262dd36f308755dacc254885def6f0 From 7239f254a34a61a7d1a701263680b7d186480bc6 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 6 Jul 2026 14:04:46 -0500 Subject: [PATCH 2/2] [Mono.Android] Suppress new IL3050 in ManagedTypeManager.RegisterNativeMembers dotnet/java-interop#1474 (pulled in by the Java.Interop bump in this PR) adds [RequiresDynamicCode] to JniEnvironment.Types.RegisterNatives(.., JniNativeMethodRegistration[], int), surfacing a new IL3050 AOT analysis warning at ManagedTypeManager.RegisterNativeMembers under NativeAOT. That broke BuildHasNoWarnings(True,False,"apk",NativeAOT), which asserts an exact warning count. Suppress for now; the JniNativeMethodRegistration[] registration path will be migrated to the blittable RegisterNatives(JniObjectReference, ReadOnlySpan) overload in a future change. Mirrors the companion change made on main in #11782. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs b/src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs index aaee4516788..2f4d0dc7acd 100644 --- a/src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs +++ b/src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs @@ -65,6 +65,7 @@ static Type MakeGenericType ( [UnconditionalSuppressMessage ("Trimming", "IL2057", Justification = "Type.GetType() can never statically know the string value parsed from parameter 'methods'.")] [UnconditionalSuppressMessage ("Trimming", "IL2067", Justification = "Delegate.CreateDelegate() can never statically know the string value parsed from parameter 'methods'.")] [UnconditionalSuppressMessage ("Trimming", "IL2072", Justification = "Delegate.CreateDelegate() can never statically know the string value parsed from parameter 'methods'.")] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "JniNativeMethodRegistration[] registration path will be migrated to the blittable RegisterNatives overload in a future change.")] public override void RegisterNativeMembers ( JniType nativeClass, [DynamicallyAccessedMembers (MethodsAndPrivateNested)]