AiForms.Maui.SettingsView icon indicating copy to clipboard operation
AiForms.Maui.SettingsView copied to clipboard

Unable to convert AiForms.Settings.SettingsView to Android.Views.View

Open Dutch-0 opened this issue 3 months ago • 0 comments

While migrating my app to Maui, I receive the following exception upon opening the settings page.

System.InvalidOperationException: Unable to convert AiForms.Settings.SettingsView to Android.Views.View
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 121
   at Microsoft.Maui.ElementHandlerExtensions.ToPlatform(IElementHandler elementHandler) in D:\a\_work\1\s\src\Core\src\Handlers\ElementHandlerExtensions.cs:line 22
   at Microsoft.Maui.ViewHandlerExtensions.GetDesiredSizeFromHandler(IViewHandler viewHandler, Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Core\src\Handlers\ViewHandlerExtensions.Android.cs:line 81
   at Microsoft.Maui.Handlers.ViewHandler`2[[AiForms.Settings.SettingsView, SettingsView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[AiForms.Settings.Platforms.Droid.AiRecyclerView, SettingsView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetDesiredSize(Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.Android.cs:line 18
   at Microsoft.Maui.Layouts.LayoutExtensions.ComputeDesiredSize(IView view, Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Core\src\Layouts\LayoutExtensions.cs:line 27
   at Microsoft.Maui.Controls.VisualElement.MeasureOverride(Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 1893
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Measure(Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 1880
   at Microsoft.Maui.Layouts.LayoutExtensions.MeasureContent(IContentView contentView, Thickness inset, Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Core\src\Layouts\LayoutExtensions.cs:line 163
   at Microsoft.Maui.Layouts.LayoutExtensions.MeasureContent(IContentView contentView, Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Core\src\Layouts\LayoutExtensions.cs:line 142
   at Microsoft.Maui.Controls.TemplatedView.Microsoft.Maui.ICrossPlatformLayout.CrossPlatformMeasure(Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Controls\src\Core\TemplatedView\TemplatedView.cs:line 128
   at Microsoft.Maui.Platform.ContentViewGroup.CrossPlatformMeasure(Double widthConstraint, Double heightConstraint) in D:\a\_work\1\s\src\Core\src\Platform\Android\ContentViewGroup.cs:line 51
   at Microsoft.Maui.Platform.ContentViewGroup.OnMeasure(Int32 widthMeasureSpec, Int32 heightMeasureSpec) in D:\a\_work\1\s\src\Core\src\Platform\Android\ContentViewGroup.cs:line 73
   at Android.Views.View.n_OnMeasure_II(IntPtr jnienv, IntPtr native__this, Int32 widthMeasureSpec, Int32 heightMeasureSpec) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.Views.View.cs:line 19581
   at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V(_JniMarshal_PPII_V callback, IntPtr jnienv, IntPtr klazz, Int32 p0, Int32 p1) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 158

This settings page is actually a View, inside a Sharpnado Tab-page. This error only occurs when using AIForms inside a View and not a page

Dutch-0 avatar Mar 19 '24 19:03 Dutch-0