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.98k stars 1.72k forks source link

[WinUI] Grid Bug !! #16190

Open dsuny opened 1 year ago

dsuny commented 1 year ago

Description

image

image

Steps to Reproduce

https://github.com/dsuny/MauiApp1GridBug

Link to public reproduction project repository

https://github.com/dsuny/MauiApp1GridBug

Version with bug

7.0.86

Last version that worked well

6.0

Affected platforms

Windows

Affected platform versions

net7.0-windows10.0.19041.0

Did you find any workaround?

Padding value change

Relevant log output

Microsoft.Maui.IViewHandler: Error: Unexpected exception in OnHandlerChangedCore.

System.ArgumentException: Value does not fall within the expected range. at WinRT.ExceptionHelpers.gThrow|20_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Microsoft.UI.Xaml.IDependencyObjectMethods.SetValue(IObjectReference _obj, DependencyProperty dp, Object value) at Microsoft.UI.Xaml.DependencyObject.SetValue(DependencyProperty dp, Object value) at Microsoft.Maui.Platform.ViewExtensions.UpdateProperty(FrameworkElement platformControl, DependencyProperty property, Object value) at Microsoft.Maui.Platform.TextBlockExtensions.UpdatePadding(TextBlock platformControl, ILabel label) at Microsoft.Maui.Handlers.LabelHandler.MapPadding(ILabelHandler handler, ILabel label) at Microsoft.Maui.PropertyMapper`2.<>cDisplayClass5_0.b0(IElementHandler h, IElement v) at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IElement view) at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IElement view) at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IElement view) at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler) at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page) at Microsoft.Maui.PropertyMapper`2.<>cDisplayClass5_0.b0(IElementHandler h, IElement v) at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IElement view) at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) at Microsoft.Maui.Platform.StackNavigationManager.OnNavigated(Object sender, NavigationEventArgs e) at WinRT._EventSource_globalMicrosoft_UI_Xaml_Navigation_NavigatedEventHandler.EventState.b1_0(Object sender, NavigationEventArgs e) at ABI.Microsoft.UI.Xaml.Navigation.NavigatedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e) --- End of stack trace from previous location --- at WinRT.ExceptionHelpers.gThrow|20_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(IObjectReference _obj, Type sourcePageType, Object parameter, NavigationTransitionInfo infoOverride) at Microsoft.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter, NavigationTransitionInfo infoOverride) at Microsoft.Maui.Platform.StackNavigationManager.NavigateTo(NavigationRequest args) at Microsoft.Maui.Handlers.NavigationViewHandler.RequestNavigation(INavigationViewHandler arg1, IStackNavigation arg2, Object arg3) at Microsoft.Maui.CommandMapper`2.<>cDisplayClass6_0.b0(IElementHandler h, IElement v, Object o) at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args) at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args) at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args) at Microsoft.Maui.Controls.NavigationPage.Microsoft.Maui.IStackNavigation.RequestNavigation(NavigationRequest eventArgs) at Microsoft.Maui.Controls.NavigationPage.SendHandlerUpdateAsync(Boolean animated, Action processStackChanges, Action firePostNavigatingEvents, Action fireNavigatedEvents) at Microsoft.Maui.TaskExtensions.FireAndForget(Task task, Action`1 errorCallback)

jfversluis commented 1 year ago

Could you please add some more information? What is the error you're seeing? Did this show up when you added something new to your Grid? Did you discover anything else that influences this behavior? What were you doing when this showed up? Does this only happen on Windows or also Android or iOS?

Thanks

ghost commented 1 year ago

Hi @dsuny. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

dsuny commented 1 year ago

좀 더 많은 정보를 추가해 주시겠습니까? 표시되는 오류는 무엇입니까? 새로운 것을 추가했을 때 이것이 나타 났습니까? 이 행동에 영향을 미치는 다른 것을 발견했습니까? 이것이 나타났을 때 당신은 무엇을 하고 있었습니까? 이것은 Windows 또는 Android 또는 iOS에서만 발생합니까?Grid

감사

Nice to meet you. Arrange the labels in the Grid cells so that they overlap. Specify one Padding value as a positive number and one as a negative number. When I run it with VS, the build works fine, but an error occurs. It only occurs on Windows OS. thank you.

image

Xyncgas commented 1 year ago

In my opinion, MAUI layout libraries should not throw exceptions, my philosophy is, if number crunching generates a result that doesn't meet the expectation, just simply return default (what's default is for specification)

Xyncgas commented 1 year ago

@dsuny are you new to MAUI? I am a fan of MAUI.Blazor

do you want to be friends and help each other? do you have a Telegram app link. I am studying how to program while making my own libraries as a hobby

dsuny commented 1 year ago

@dsuny are you new to MAUI? I am a fan of MAUI.Blazor

do you want to be friends and help each other? do you have a Telegram app link. I am studying how to program while making my own libraries as a hobby

Nice to meet you. I am also a Maui+Blazor developer. The links below are the libraries under development. https://github.com/MetaFrm

drasticactions commented 1 year ago

@Xyncgas Can you please keep discussions in issues to the issue at hand? You may use the discussion forum to talk about other aspects of MAUI development or your opinions.

ghost commented 1 year 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.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 6.0. Repro on Windows 11(8.0.100-preview.6.23330.14) with below Project: MauiApp1ddd.zip