Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of typemap errors triggered by XAML Live Preview #8966

Closed
hansmbakker opened this issue May 20, 2024 · 1 comment
Closed

Lots of typemap errors triggered by XAML Live Preview #8966

hansmbakker opened this issue May 20, 2024 · 1 comment
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned.

Comments

@hansmbakker
Copy link

hansmbakker commented May 20, 2024

Android application type

.NET Android (net7.0-android, net8.0-android, etc.)

Affected platform version

VS 2022 17.10 Preview 7

Description

While trying to produce logs for dotnet/runtime#106970, I found that a lot of errors regarding a missing type map were logged.

It seems to completely slow down the debugging.

This might be similar to #4727 and I saw in #4720 the errors were marked as info level logs (which is why enabling all logs starts showing them).

The reason I'm logging this issue is because I'm wondering whether the root cause of the errors should be solved?

(Also, because the crash in dotnet/runtime#106970 is Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) - I'm wondering whether that mapping issue could be related?

Steps to Reproduce

  1. Create new project
  2. Run adb preparing commands:
    adb -d shell setprop debug.mono.log default,timing,assembly,mono_log_level=debug,mono_log_mask=all
    adb logcat -G 64M
    adb logcat -c
  3. Start debugging on mobile phone
  4. Open the XAML Live Preview pane in visual studio

Did you find any workaround?

Close the XAML Live Preview pane

Relevant log output

05-20 12:02:30.275 27754 27754 W monodroid-assembly: typemap: called from
05-20 12:02:30.283 27754 27754 W monodroid-assembly: at Android.Runtime.JNIEnv.TypemapManagedToJava(Type type) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:line 527
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Runtime.JNIEnv.GetJniName(Type type) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:line 541
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Runtime.JNIEnv.FindClass(Type type) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:line 308
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Runtime.JNIEnv.AssertCompatibleArrayTypes(IntPtr sourceArray, Type destType) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:line 617
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Runtime.JNIEnv._GetArray(IntPtr array_ptr, Type element_type) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:line 1089
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Runtime.JNIEnv.GetArray(IntPtr array_ptr, JniHandleOwnership transfer, Type element_type) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:line 982
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Java.IO.OutputStream.n_Write_arrayBII(IntPtr jnienv, IntPtr native__this, IntPtr native_b, Int32 off, Int32 len) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.IO.OutputStream.cs:line 145
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLII_V(_JniMarshal_PPLII_V callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, Int32 p1, Int32 p2) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 297
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Java.Interop.JniNativeMethods.wrapper_native_indirect_byte_intptr_intptr_intptr_intptr(IntPtr& , IntPtr , IntPtr , IntPtr , IntPtr )
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Java.Interop.JniEnvironment.InstanceMethods.CallBooleanMethod(JniObjectReference instance, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:line 20030
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeAbstractBooleanMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 136
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Android.Graphics.Bitmap.Compress(CompressFormat format, Int32 quality, Stream stream) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.Graphics.Bitmap.cs:line 669
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Microsoft.Maui.Media.ScreenshotResult.PlatformCopyToAsync(Stream destination, ScreenshotFormat format, Int32 quality) in D:\a\_work\1\s\src\Essentials\src\Screenshot\Screenshot.android.cs:line 137
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Microsoft.Maui.Media.ScreenshotResult.CopyToAsync(Stream destination, ScreenshotFormat format, Int32 quality) in D:\a\_work\1\s\src\Essentials\src\Screenshot\Screenshot.shared.cs:line 294
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at Microsoft.Maui.VisualDiagnostics.ScreenshotResultToArray(IScreenshotResult result, ScreenshotFormat format, Int32 quality) in D:\a\_work\1\s\src\Core\src\VisualDiagnostics\VisualDiagnostics.cs:line 108
05-20 12:02:30.283 27754 27754 W monodroid-assembly:    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<ScreenshotResultToArray>d__14](<ScreenshotResultToArray>d__14& stateMachine)
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.Maui.VisualDiagnostics.ScreenshotResultToArray(IScreenshotResult result, ScreenshotFormat format, Int32 quality)
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.Maui.VisualDiagnostics.CaptureAsJpegAsync(IWindow window, Int32 quality) in D:\a\_work\1\s\src\Core\src\VisualDiagnostics\VisualDiagnostics.cs:line 99
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<CaptureAsJpegAsync>d__13](<CaptureAsJpegAsync>d__13& stateMachine)
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.Maui.VisualDiagnostics.CaptureAsJpegAsync(IWindow window, Int32 quality)
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.VisualStudio.DesignTools.MauiTap.WindowContext.CaptureFrameAsync()
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<CaptureFrameAsync>d__25](<CaptureFrameAsync>d__25& stateMachine)
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.VisualStudio.DesignTools.MauiTap.WindowContext.CaptureFrameAsync()
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.VisualStudio.DesignTools.MauiTap.WindowContext.CaptureAndSendFrame()
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<CaptureAndSendFrame>d__24](<CaptureAndSendFrame>d__24& stateMachine)
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.VisualStudio.DesignTools.MauiTap.WindowContext.CaptureAndSendFrame()
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.VisualStudio.DesignTools.MobileTap.DispatcherExtensions.<>c__DisplayClass3_0.<InvokeAsync>b__0()
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.VisualStudio.DesignTools.MobileTap.DispatcherExtensions.<>c__DisplayClass4_0`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<InvokeAsync>b__1()
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass4_0.<DispatchImplementation>b__0() in D:\a\_work\1\s\src\Core\src\Dispatching\Dispatcher.Android.cs:line 24
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Java.Lang.Thread.RunnableImplementor.Run() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:line 36
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.Lang.IRunnable.cs:line 84
05-20 12:02:30.284 27754 27754 W monodroid-assembly:    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 22
05-20 12:02:30.286 27754 27754 I monodroid-assembly: typemap: unable to find mapping to a Java type from managed type 'System.Byte, System.Private.CoreLib'
05-20 12:02:30.286 27754 27754 I monodroid-timing: [1/6] Typemap.managed_to_java: end, total time; elapsed: 0:0::192770
05-20 12:02:30.287 27754 27754 W monodroid: typemap: failed to map managed type to Java type: System.Byte, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (Module ID: 835733d7-9ad6-458d-935c-3274e66adcb8; Type token: 33554594)
@hansmbakker hansmbakker added the needs-triage Issues that need to be assigned. label May 20, 2024
@hansmbakker hansmbakker changed the title Lots of typemap errors, e.g. triggered by XAML Live Preview Lots of typemap errors triggered by XAML Live Preview May 20, 2024
@jpobst jpobst added the Area: App Runtime Issues in `libmonodroid.so`. label May 20, 2024
@jpobst jpobst removed their assignment May 20, 2024
@grendello
Copy link
Contributor

@hansmbakker this is not an error, as not all types are type-mapped. In this case it's System.Byte, which is not derived from Java.Lang.Object, so it won't be type-mapped. Yes, the "noise" is unfortunate but it's show only when the debug.mono.log system property has the assembly category, which is normally not the case. We need this logging to help use see what's going on in cases when we have Java<->Managed interop issues.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned.
Projects
None yet
Development

No branches or pull requests

3 participants