dotnet / dotnet/android

[.NET 10 / CoreCLR] ManagedPeerType <=> JniTypeName Mismatch!

Open
#10,323 4 comments 0 reactions 0 assignees View on GitHub
Area: App Runtime
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

### Android framework version

net10.0-android (Preview)

### Affected platform version

.NET 10 (commit 510fc086 of dotnet/android and matchin .NET runtime)

### Description

Running the attached sample app (basically an empty MAUI app) produces the following warning at runtime:
```
07-23 09:52:34.685 8434 8434 D app_process64: WARNING-Java.Interop: ManagedPeerType <=> JniTypeName Mismatch! javaVM.GetJniTypeInfoForType(typeof(Android.Views.IWindowManagerInvoker)).JniTypeName="android/view/WindowManager" != "android/view/ViewManager"
07-23 09:52:34.695 8434 8434 D app_process64: at Java.Interop.JniPeerMembers..ctor(String jniPeerTypeName, Type managedPeerType, Boolean checkManagedPeerType, Boolean isInterface)
07-23 09:52:34.695 8434 8434 D app_process64: at Java.Interop.JniPeerMembers..ctor(String jniPeerTypeName, Type managedPeerType)
07-23 09:52:34.695 8434 8434 D app_process64: at Android.Runtime.XAPeerMembers..ctor(String jniPeerTypeName, Type managedPeerType)
07-23 09:52:34.695 8434 8434 D app_process64: at Android.Views.IWindowManagerInvoker..cctor()
07-23 09:52:34.695 8434 8434 D app_process64: at Android.Views.IWindowManagerInvoker.get_DefaultDisplay()
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.WindowOverlay.Initialize()
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.Handlers.WindowHandler.OnRootViewChanged(Object sender, EventArgs e)
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.Platform.NavigationRootManager.SetContentView(IView view)
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.Platform.NavigationRootManager.Connect(IView view, IMauiContext mauiContext)
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.Handlers.WindowHandler.CreateRootViewFromContent(IWindowHandler handler, IWindow window)
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.Handlers.WindowHandler.MapContent(IWindowHandler handler, IWindow window)
07-23 09:52:34.695 8434 8434 D app_process64: at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.b__0(IElementH
```

### Steps to Reproduce

1. Compile [emptymaui.zip](https://github.com/user-attachments/files/21382716/emptymaui.zip) app with `dotnet build -f net10.0-android -p:UseMonoRuntime=false`
2. Deploy to simulator/device and observe logcat

### Did you find any workaround?

_No response_

### Relevant log output

```shell
Adding reference to Sentry and initializing it produces few more reproducible type mismatches (observed on our app):

07-23 09:58:38.883 8503 8503 W monodroid-assembly: typemap: managed type 'Sentry.JavaSdk.Sentry+IOptionsConfigurationInvoker' (hash 4a06171aebf8f732) not found in module [edd1f589-5147-4187-9fe0-56e2ff51b61b] (Sentry.Bindings.Android).
07-23 09:58:38.883 8503 8503 D app_process64: WARNING-Java.Interop: ManagedPeerType <=> JniTypeName Mismatch! javaVM.GetJniTypeInfoForType(typeof(Sentry.JavaSdk.Sentry+IOptionsConfigurationInvoker)).JniTypeName="" != "io/sentry/Sentry$OptionsConfiguration"
07-23 09:58:38.895 8503 8503 D app_process64: at Java.Interop.JniPeerMembers..ctor(String, Type, Boolean, Boolean )
07-23 09:58:38.895 8503 8503 D app_process64: at Java.Interop.JniPeerMembers..ctor(String, Type)
07-23 09:58:38.895 8503 8503 D app_process64: at Sentry.JavaSdk.Sentry.IOptionsConfigurationInvoker..cctor()
07-23 09:58:38.895 8503 8503 D app_process64: at Sentry.JavaSdk.Sentry.IOptionsConfigurationInvoker.GetConfigure_Lio_sentry_SentryOptions_Handler()
07-23 09:58:38.895 8503 8503 D app_process64: at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType, Type , ReadOnlySpan`1 )
07-23 09:58:38.895 8503 8503 D app_process64: at Android.Runtime.JNIEnvInit.RegisterJniNatives(IntPtr, Int32, IntPtr, IntPtr, Int32)
07-23 09:58:38.895 8503 8503 D app_process64: at Java.Interop.JniEnvironment.Object.AllocObject(JniObjectReference)
07-23 09:58:38.895 8503 8503 D app_process64: at Java.Interop.JniType.AllocObject()
07-23 09:58:38.895 8503 8503 D app_process64: at Java.Interop.JniPeerMembers.JniInstanceMethods.StartCreateInstance(String, Type, JniArgumentValue* )
07-23 09:58:38.895 8503 8503 D app_process64: at Java.Lang.Object..ctor()
07-23 09:58:38.895 8503 8503 D app_process64: at Sentry.SentrySdk.InitSentryAndroidSdk(SentryOptions)
07-23 09:58:38.895 8503 8503 D app_process64: at Sentry.SentrySdk.InitHub(SentryOptions)
07-23 09:58:38.895 8503 8503 D app_process64: at Sentry.SentrySdk.Init(Action`1 )
07-23 09:58:38.895 8503 8503 D app_process64: at MailClient.Mobile.Droid.AndroidApp.InitSentry(PlatformUtils platformUtils)
07-23 09:58:38.895 8503 8503 D app_process64: at MailClient.Mobile.Droid.AndroidApp.InitializeApp(Context

07-23 09:58:38.995 8503 8503 D app_process64: WARNING-Java.Interop: ManagedPeerType <=> JniTypeName Mismatch! javaVM.GetJniTypeInfoForType(typeof(Android.Runtime.JavaList)).JniTypeName="java/util/ArrayList" != "java/util/List"
07-23 09:58:38.995 8503 8503 D app_process64: at Java.Interop.JniPeerMembers..ctor(String, Type, Boolean, Boolean )
07-23 09:58:38.995 8503 8503 D app_process64: at Android.Runtime.JavaList..cctor()
07-23 09:58:38.995 8503 8503 D app_process64: at Android.Runtime.JavaList.Iterator()
07-23 09:58:38.995 8503 8503 D app_process64: at Android.Runtime.JavaList`1.GetEnumerator()
07-23 09:58:38.995 8503 8503 D app_process64: at Android.Runtime.JavaList`1.System.Collections.IEnumerable.GetEnumerator()
07-23 09:58:38.995 8503 8503 D app_process64: at System.Linq.Enumerable.OfTypeIterator`1.MoveNext()
07-23 09:58:38.995 8503 8503 D app_process64: at System.Linq.Enumerable.IEnumerableWhereIterator`1.MoveNext()
07-23 09:58:38.995 8503 8503 D app_process64: at System.Linq.Enumerable.CastIterator[TResult](IEnumerable)+MoveNext()
07-23 09:58:38.995 8503 8503 D app_process64: at System.Linq.Enumerable.TryGetFirstNonIterator[TSource](IEnumerable`1, Boolean& )
07-23 09:58:38.995 8503 8503 D app_process64: at Sentry.Android.AndroidEventProcessor..ctor(SentryAndroidOptions)
07-23 09:58:38.995 8503 8503 D app_process64: at Sentry.SentrySdk.InitSentryAndroidSdk(SentryOptions)
07-23 09:58:38.995 8503 8503 D app_process64: at Sentry.SentrySdk.InitHub(SentryOptions)
07-23 09:58:38.995 8503 8503 D app_process64: at Sentry.SentrySdk.Init(Action`1 )
07-23 09:58:38.995 8503 8503 D app_process64: at MailClient.Mobile.Droid.AndroidApp.InitSentry(PlatformUtils platformUtils)
07-23 09:58:38.995 8503 8503 D app_process64: at MailClient.Mobile.Droid.AndroidApp.InitializeApp(Context context)
07-23 09:58:38.995 8503 8503 D app_process64: at MailClient.Mobile.Droid.AndroidApp.OnCreate()
07-23 09:58:38.995 8503 8503 D app_process64: at Android.App.Application.n_O
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.