Skip to content

Commit a2d46b3

Browse files
[release/11.0.1xx-preview6] Bump to dotnet/java-interop@c24a8e9b (#11997)
### 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<JniNativeMethod>) 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<T> 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: #11633 ### [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<JniNativeMethod>) 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>
1 parent 2114bc8 commit a2d46b3

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static Type MakeGenericType (
6565
[UnconditionalSuppressMessage ("Trimming", "IL2057", Justification = "Type.GetType() can never statically know the string value parsed from parameter 'methods'.")]
6666
[UnconditionalSuppressMessage ("Trimming", "IL2067", Justification = "Delegate.CreateDelegate() can never statically know the string value parsed from parameter 'methods'.")]
6767
[UnconditionalSuppressMessage ("Trimming", "IL2072", Justification = "Delegate.CreateDelegate() can never statically know the string value parsed from parameter 'methods'.")]
68+
[UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "JniNativeMethodRegistration[] registration path will be migrated to the blittable RegisterNatives overload in a future change.")]
6869
public override void RegisterNativeMembers (
6970
JniType nativeClass,
7071
[DynamicallyAccessedMembers (MethodsAndPrivateNested)]

0 commit comments

Comments
 (0)