dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.96k stars 1.71k forks source link

[Android] ContentViewHandler is incompatible #7884

Closed Phenek closed 3 months ago

Phenek commented 2 years ago

Description

I'm testing MAUI about collection scroll etc..., When I try to embed a page that contains a CarouselView control with some ContentView in it.

It crashes with the following exception: Microsoft.Maui.Platform.ToPlatformException: 'Microsoft.Maui.Handlers.ContentViewHandler found for Microsoft.Maui.Controls.ContentView is incompatible'. Only on Android I got this exception.

PS: I have a lot of similar issue about incompatible handlers with Button, Entries, etc... When it's happen on iOS the page will just not render, but no crash no exception. It's just a guess.

Steps to Reproduce

You can download my workplace project and run it. ScrollConflicts.zip

On Android it will crash instantly, with the related exception.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android

Relevant log output

Download the project :) ScrollConflicts.zip

kristinx0211 commented 2 years ago

error on android running: image


> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.scrollconflicts/crc6423b8bf1c258f833a.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.scrollconflicts/crc6423b8bf1c258f833a.MainActivity }
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/ScrollConflicts.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Mono.Android.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Java.Interop.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Collections.dll [External]
Resolved pending breakpoint for 'Android.Runtime.JNIEnv.RegisterJniNatives(System.IntPtr, System.Int32, System.IntPtr, System.IntPtr, System.Int32)' to /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:124 [0x00000].
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Threading.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.InteropServices.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Threading.Thread.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Diagnostics.StackTrace.dll [External]
Loaded assembly: data-0x7bb7262ae030 [External]
Loaded assembly: data-0x7bb7262ee070 [External]
Loaded assembly: data-0x7bb7d0832660 [External]
Loaded assembly: data-0x7bb7262de060 [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/netstandard.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Linq.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Collections.Concurrent.dll [External]
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:419 [0x00000].
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Text.Json.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Text.Encodings.Web.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.ComponentModel.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Maui.Controls.dll [External]
[scrollconflict] Late-enabling -Xcheck:jni
[scrollconflict] Unexpected CPU variant for X86 using defaults: x86_64
[CompatibilityChangeReporter] Compat change id reported: 171979766; UID 10151; state: ENABLED
[GraphicsEnvironment] ANGLE Developer option for 'com.companyname.scrollconflicts' set to: 'default'
[GraphicsEnvironment] Neither updatable production driver nor prerelease driver is supported.
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[debug-app-helper] Checking if libmonodroid was unpacked to /data/app/~~nTgeW7iWGd9TV-vwGnJ8-Q==/com.companyname.scrollconflicts-FdSVFAkeXcsiTzmrlC9QaA==/lib/x86_64/libmonodroid.so
[debug-app-helper] Native libs extracted to /data/app/~~nTgeW7iWGd9TV-vwGnJ8-Q==/com.companyname.scrollconflicts-FdSVFAkeXcsiTzmrlC9QaA==/lib/x86_64, assuming application/android:extractNativeLibs == true
[debug-app-helper] Setting up for DSO lookup in app data directories
[debug-app-helper] Added filesystem DSO lookup location: /data/app/~~nTgeW7iWGd9TV-vwGnJ8-Q==/com.companyname.scrollconflicts-FdSVFAkeXcsiTzmrlC9QaA==/lib/x86_64
[debug-app-helper] Using runtime path: /data/app/~~nTgeW7iWGd9TV-vwGnJ8-Q==/com.companyname.scrollconflicts-FdSVFAkeXcsiTzmrlC9QaA==/lib/x86_64
[debug-app-helper] checking directory: `/data/user/0/com.companyname.scrollconflicts/files/.__override__/lib`
[debug-app-helper] directory does not exist: `/data/user/0/com.companyname.scrollconflicts/files/.__override__/lib`
[debug-app-helper] Checking whether Mono runtime exists at: /data/user/0/com.companyname.scrollconflicts/files/.__override__/libmonosgen-2.0.so
[debug-app-helper] Checking whether Mono runtime exists at: /data/app/~~nTgeW7iWGd9TV-vwGnJ8-Q==/com.companyname.scrollconflicts-FdSVFAkeXcsiTzmrlC9QaA==/lib/x86_64/libmonosgen-2.0.so
[debug-app-helper] Mono runtime found at: /data/app/~~nTgeW7iWGd9TV-vwGnJ8-Q==/com.companyname.scrollconflicts-FdSVFAkeXcsiTzmrlC9QaA==/lib/x86_64/libmonosgen-2.0.so
[scrollconflict] Attempt to remove non-JNI local reference, dumping thread
[DOTNET] JNI_OnLoad: JNI_OnLoad in pal_jni.c
[monodroid] Creating public update directory: `/data/user/0/com.companyname.scrollconflicts/files/.__override__`
[scrollconflict] Attempt to remove non-JNI local reference, dumping thread
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:63592,embedding=1
[monodroid-assembly] open_from_bundles: failed to load assembly ScrollConflicts.dll
[monodroid-gc] GREF GC Threshold: 46080
[monodroid-assembly] open_from_bundles: failed to load assembly Mono.Android.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Java.Interop.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.InteropServices.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.Thread.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.StackTrace.dll
[scrollconflict] Attempt to remove non-JNI local reference, dumping thread
[monodroid-assembly] open_from_bundles: failed to load assembly netstandard.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Linq.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.Concurrent.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Json.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encodings.Web.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.ObjectModel.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ObjectModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Maui.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Graphics.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Essentials.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Abstractions.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Maui.Graphics.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Maui.Essentials.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Extensions.Logging.Abstractions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.TypeConverter.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.ComponentModel.TypeConverter.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Uri.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Private.Uri.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Loader.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.Loader.dll [External]
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:414 [0x00000].
[monodroid-assembly] open_from_bundles: failed to load assembly System.Memory.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Memory.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.Lightweight.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.ILGeneration.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Primitives.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Reflection.Primitives.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.CompilerServices.Unsafe.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.CompilerServices.Unsafe.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Core.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Core.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.Abstractions.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Extensions.DependencyInjection.Abstractions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Xaml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Maui.Controls.Xaml.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Extensions.Configuration.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Extensions.Configuration.Abstractions.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Extensions.Logging.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.AppCompat.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.Google.Android.Material.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SwipeRefreshLayout.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.AppCompat.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.Google.Android.Material.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.SwipeRefreshLayout.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Fragment.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Activity.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.ViewModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Common.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SavedState.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Fragment.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Activity.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Lifecycle.ViewModel.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Lifecycle.Common.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.SavedState.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.DrawerLayout.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CustomView.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Navigation.Runtime.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.DrawerLayout.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.CustomView.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Navigation.Runtime.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Net.Primitives.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Net.Primitives.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Extensions.DependencyInjection.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.Tracing.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Diagnostics.Tracing.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Xml.ReaderWriter.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Xml.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Private.Xml.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encoding.Extensions.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Text.Encoding.Extensions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.RegularExpressions.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Text.RegularExpressions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Numerics.Vectors.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Numerics.Vectors.dll [External]
[scrollconflict] Explicit concurrent copying GC freed 546(77KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 1969KB/2626KB, paused 411us,69us total 3.924ms
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.RecyclerView.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CardView.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.RecyclerView.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.CardView.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Loader.dll
[libEGL] loaded /vendor/lib64/egl/libEGL_emulation.so
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Loader.dll [External]
[libEGL] loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
[libEGL] loaded /vendor/lib64/egl/libGLESv2_emulation.so
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Compatibility.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Microsoft.Maui.Controls.Compatibility.dll [External]
Thread started:  #2
Thread started:  #3
Thread started:  #4
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Json.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.DataContractSerialization.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Xml.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.Serialization.Json.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Private.DataContractSerialization.dll [External]
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.Serialization.Xml.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Primitives.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Runtime.Serialization.Primitives.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CoordinatorLayout.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.CoordinatorLayout.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.LiveData.Core.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/Xamarin.AndroidX.Lifecycle.LiveData.Core.dll [External]
[scrollconflict] Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
[scrollconflict] Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
Thread started: .NET Timers #5
[scrollconflict] Explicit concurrent copying GC freed 453(90KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 3007KB/6014KB, paused 509us,66us total 6.919ms
[monodroid-assembly] open_from_bundles: failed to load assembly System.Linq.Expressions.dll
Loaded assembly: /data/data/com.companyname.scrollconflicts/files/.__override__/System.Linq.Expressions.dll [External]
[HostConnection] createUnique: call
[HostConnection] HostConnection::get() New Host Connection established 0x7bb5b629dc50, tid 20349
[HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings 
```ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2 
[OpenGLRenderer] Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
[OpenGLRenderer] Failed to initialize 101010-2 format, error = EGL_SUCCESS
[EGL_emulation] eglCreateContext: 0x7bb5b629d350: maj 2 min 0 rcv 2
[EGL_emulation] eglMakeCurrent: 0x7bb5b629d350: ver 2 0 (tinfo 0x7bb7dcf65080) (first time)
[Gralloc4] mapper 4.x is not supported
[HostConnection] createUnique: call
[HostConnection] HostConnection::get() New Host Connection established 0x7bb5b629f810, tid 20349
[goldfish-address-space] allocate: Ask for block of size 0x100
[goldfish-address-space] allocate: ioctl allocate returned offset 0x3f3ffe000 size 0x2000
[Gralloc4] allocator 4.x is not supported
[HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2 
**Microsoft.Maui.Platform.ToPlatformException:** 'Microsoft.Maui.Handlers.ContentViewHandler found for Microsoft.Maui.Controls.ContentView is incompatible'
RemcoDEV commented 2 years ago

We experience the same issue when using the new MAUI workload shipped with the latest VS 2022 preview.

jsuarezruiz commented 2 years ago
The specified child already has a parent. You must call removeView() on the child's parent first.

 at Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualVoidMethod(JniObjectReference instance, JniObjectReference type, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:line 12324
   at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(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 35
   at Android.Views.ViewGroup.AddView(View child) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net6.0/android-32/mcw/Android.Views.ViewGroup.cs:line 1999
   at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler) in C:\Projects\maui\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 44
   at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page) in C:\Projects\maui\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 49
   at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IContentViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v) in C:\Projects\maui\src\Core\src\PropertyMapper.cs:line 183
   at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in C:\Projects\maui\src\Core\src\PropertyMapper.cs:line 47
   at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) in C:\Projects\maui\src\Core\src\PropertyMapper.cs:line 82
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in C:\Projects\maui\src\Core\src\Handlers\Element\ElementHandler.cs:line 74
   at Microsoft.Maui.Handlers.ViewHandler.SetVirtualView(IElement element) in C:\Projects\maui\src\Core\src\Handlers\View\ViewHandler.cs:line 125
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in C:\Projects\maui\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
   at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view) in C:\Projects\maui\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 27
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in C:\Projects\maui\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in C:\Projects\maui\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 64
   at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in C:\Projects\maui\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 20
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in C:\Projects\maui\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 299
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in C:\Projects\maui\src\Core\src\Platform\ElementExtensions.cs:line 98
  --- End of managed Java.Lang.IllegalStateException stack trace ---
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
    at android.view.ViewGroup.addViewInner(ViewGroup.java:5247)
    at android.view.ViewGroup.addView(ViewGroup.java:5076)
    at android.view.ViewGroup.addView(ViewGroup.java:5016)
    at android.view.ViewGroup.addView(ViewGroup.java:4988)
    at crc645d80431ce5f73f11.CarouselViewAdapter_2.n_onBindViewHolder(Native Method)
    at crc645d80431ce5f73f11.CarouselViewAdapter_2.onBindViewHolder(CarouselViewAdapter_2.java:38)
    at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254)
    at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337)
    at crc645d80431ce5f73f11.MauiCarouselRecyclerView.n_onMeasure(Native Method)
    at crc645d80431ce5f73f11.MauiCarouselRecyclerView.onMeasure(MauiCarouselRecyclerView.java:63)
    at android.view.View.measure(View.java:25773)
    at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_onMeasure(Native Method)
    at crc6452ffdc5b34af3a0f.LayoutViewGroup.onMeasure(LayoutViewGroup.java:55)
    at android.view.View.measure(View.java:25773)
    at crc6452ffdc5b34af3a0f.ContentViewGroup.n_onMeasure(Native Method)
    at crc6452ffdc5b34af3a0f.ContentViewGroup.onMeasure(ContentViewGroup.java:63)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
    at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1204)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:723)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:795)
    at com.google.android.material.appbar.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:99)
    at com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:2172)
    at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:866)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at com.android.internal.policy.DecorView.onMeasure(DecorView.java:761)
    at android.view.View.measure(View.java:25773)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3611)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3085)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2126)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8653)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
    at android.view.Choreographer.doCallbacks(Choreographer.java:845)
    at android.view.Choreographer.doFrame(Choreographer.java:780)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7839)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Phenek commented 2 years ago

@jsuarezruiz Thanks a lot!

PS: But I don't understand why this view has a parent before add it for the first time.

PureWeen commented 2 years ago

This is a duplicate of this issue

https://github.com/dotnet/maui/issues/9744

You can't use another View as your ItemSource

What you might want here is a DataTemplateSelector and then based on whatever is bound to your CarouselView you would return the DataTemplate you want to use.

KPHIBYE commented 2 years ago

@PureWeen I'm not sure if you were referring to me, but I want to use a collection of Views as ItemsSource and not just a single View and all Views are of the same Type and supposed to look the same, so no DataTemplateSelector should be necessary.

PureWeen commented 2 years ago

@KPHIBYE you can't currently use a collection of views as an ItemSource. Because of how the CarouselView works you might have a scenario where one of the elements inside your ItemSource is bound to two different created DataTemplates. So now that view has to exist two different places. You can't reuse a view two different places otherwise you'll get the exception indicated here.

The ItemSource is meant to purely be data, and then you bind that data to your DataTemplate.

So in your scenario you would need to do something like this instead (not sure if the syntax for the array I've done here is 100 percent correct)

<CarouselView Loop="True">
    <CarouselView.ItemsSource>
        <x:Array Type="{x:Type string}">
             "Item 1"
            "Item 2"
        </x:Array>
    </CarouselView.ItemsSource>
    <CarouselView.ItemTemplate>
        <DataTemplate>
            <ContentView>
                       <Label Text="{Binding}" />
            </ContentView>
        </DataTemplate>
    </CarouselView.ItemTemplate>
</CarouselView>

Pinging @rmarinho just in case I'm stating anything here incorrectly.

Phenek commented 2 years ago

Okay thanks @PureWeen, I understand the issue. I will use TemplateSelector for best practise, Even if I use to do it without on Xamarin, and the two popular Carousel librairies.

PS: For a speed workaround making Loop="False", compile and run very well for me.

KPHIBYE commented 2 years ago

@PureWeen thanks for the clarification and the explanation of the problem. I just want to ask two additional questions:

  1. Is the inability to use a collection of Views as ItemsSource a bug since this was possible on Xamarin.Forms?
  2. Is Loop="False" a viable workaround that will last, or "undefined behavior" that could change with any new release?
PureWeen commented 2 years ago

@PureWeen thanks for the clarification and the explanation of the problem. I just want to ask two additional questions:

  1. Is the inability to use a collection of Views as ItemsSource a bug since this was possible on Xamarin.Forms?

We'll need to investigate this one a bit more. FYI @rmarinho

rmarinho commented 2 years ago

I think the issue is we now reuse the handler of the view, and before we were always creating a new Renderer for the view .. https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.Android/CollectionView/ItemContentView.cs#L128

PureWeen commented 2 years ago

I think the issue is we now reuse the handler of the view, and before we were always creating a new Renderer for the view .. https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.Android/CollectionView/ItemContentView.cs#L128

@KPHIBYE it's a bit of an unfortunate circumstance. Technically this worked in XF but it really shouldn't have worked :-/ In XF it would create another renderer for the same view, so the same cross platform view would effectively have two renderers. The xplat view would only know about the latest renderer and the older renderer wouldn't really know that it was no longer top dog.

This usually worked ok but when it stopped working it would fail in really confusing ways where the renderers would effectively start fighting each other.

ghost commented 8 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.