[release/11.0.1xx-preview6] Bump external/Java.Interop from 7049364 to c24a8e9b#11997
Merged
jonathanpeppers merged 2 commits intoJul 6, 2026
Merged
Conversation
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
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the external/Java.Interop submodule to pick up a fix for a .NET 11 Preview 6 MAUI Release (composite R2R + startup MIBC/PGO) startup crash during JNI native registration, where non-blittable registration data could be miscompiled and corrupt JNI method names.
Changes:
- Fast-forward
external/Java.Interopfrom7049364toc24a8e9b(per PR description: dotnet/java-interop#1474). - Moves JNI native registration to a blittable
JniNativeMethod-based path to avoid problematic non-blittable struct marshalling under crossgen2.
…veMembers 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>
Member
Author
simonrozsival
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Bumps
external/Java.Interopfrom7049364toc24a8e9b(tip ofdotnet/java-interop/release/11.0.1xx-preview6).Why
preview.6 Release builds of MAUI apps crash on startup:
Debuganddotnet new androidare unaffected; only MAUI Release (composite ReadyToRun + startup MIBC/PGO) reproduces.Root cause
The default registration path passed a non-blittable
JniNativeMethodRegistration[](string Name; string Signature; Delegate Marshaler) through adelegate* unmanaged<>call. dotnet/runtime#126911 moved array-of-struct marshalling into a managedStructureMarshaler<T>whose blittable-only fallback is miscompiled by crossgen2 when the marshaller is precompiled hot under composite R2R + MIBC. It emits a rawMemmovethat blits a managedstringreference straight into the nativechar* name, so JNI receives garbage method names (????) and registration fails withNoSuchMethodError.Fix
Picks up dotnet/java-interop#1474 — Register JNI natives via blittable
JniNativeMethod. It reworks the singleRegisterNativeschokepoint to marshal names/signatures to UTF-8 ourselves and dispatch through the blittableRegisterNatives(ReadOnlySpan<JniNativeMethod>)overload, so there is noStructureMarshaler<T>involved and it is correct regardless of the crossgen2 bug. This fixesManagedPeer,AndroidTypeManager, andManagedTypeManagertogether.Submodule fast-forward, exactly one commit, all in Java.Interop:
Companion change: suppress new IL3050 warning
#1474adds[RequiresDynamicCode]toRegisterNatives(.., JniNativeMethodRegistration[], int), which surfaces a newIL3050AOT analysis warning atManagedTypeManager.RegisterNativeMembersunder NativeAOT and breaksBuildHasNoWarnings(True,False,"apk",NativeAOT)(exact-count assertion, 10 → 12).This PR adds the same one-line
[UnconditionalSuppressMessage("AOT", "IL3050", ...)]that main carries (companion to the JI bump in #11782). TheJniNativeMethodRegistration[]path will be migrated to the blittableRegisterNatives(ReadOnlySpan<JniNativeMethod>)overload in a future change.(main's #11782 also removed the
Java.Runtime.Environmentproject from the solution, but that came from an unrelated upstream PR, dotnet/java-interop#1447, which is not part of this narrow #1474-only bump, so it is intentionally omitted here.)Fixes #11633