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
22.04k stars 1.73k forks source link

[Windows] Get a crash trying to use FlyoutPage #4090

Closed jsuarezruiz closed 2 years ago

jsuarezruiz commented 2 years ago

Description

Get a crash trying to use FlyoutPage

System.ArgumentException: 'Source object type is not a projected type and does not inherit from a projected type. (Parameter 'value')'

Steps to Reproduce

  1. Download ControlGallery.zip
  2. Try to navigate to the "FlyoutPage sample".

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10 1909

Did you find any workaround?

No response

Relevant log output

at WinRT.CastExtensions.GetRefForObject(Object value)
   at WinRT.CastExtensions.As[TInterface](Object value)
   at WinRT.Interop.WindowNative.GetWindowHandle(Object target)
   at Microsoft.Maui.Essentials.Platform.get_CurrentWindowHandle()
   at Microsoft.Maui.Essentials.Platform.get_CurrentWindowId()
   at Microsoft.Maui.Essentials.Platform.get_CurrentAppWindow()
   at Microsoft.Maui.Essentials.DeviceDisplayImplementation.GetMainDisplayInfo()
   at Microsoft.Maui.Essentials.DeviceDisplay.get_MainDisplayInfo()
   at Microsoft.Maui.Controls.FlyoutPage.Microsoft.Maui.Controls.IFlyoutPageController.get_ShouldShowSplitMode()
   at Microsoft.Maui.Controls.FlyoutPage.UpdateFlyoutLayoutBehavior(FlyoutPage page)
   at Microsoft.Maui.Controls.FlyoutPage.OnAppearing()
   at Microsoft.Maui.Controls.Page.SendAppearing()
   at Microsoft.Maui.Controls.NavigationPage.OnCurrentPageChanged(BindableObject bindable, Object oldValue, Object newValue)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindablePropertyKey propertyKey, Object value)
   at Microsoft.Maui.Controls.NavigationPage.set_CurrentPage(Page value)
   at Microsoft.Maui.Controls.NavigationPage.PushPage(Page page)
   at Microsoft.Maui.Controls.NavigationPage.MauiNavigationImpl.<>c__DisplayClass9_0.<OnPushAsync>b__0()
   at Microsoft.Maui.Controls.NavigationPage.<SendHandlerUpdateAsync>d__21.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at ControlGallery.MainPage.<<-ctor>b__4_0>d.MoveNext() in C:\Users\jsuarez\Downloads\dotnet-maui-samples-main\ControlGallery\ControlGallery\Views\XAML\MainPage.xaml.cs:line 19
PureWeen commented 2 years ago

This will be fixed here https://github.com/dotnet/maui/pull/3735