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

Don't propagate handler updates when updating the Frame inside VisualElement #22271

Closed
PureWeen opened this issue May 7, 2024 · 0 comments · Fixed by #22347
Closed

Don't propagate handler updates when updating the Frame inside VisualElement #22271

PureWeen opened this issue May 7, 2024 · 0 comments · Fixed by #22347
Assignees
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
Milestone

Comments

@PureWeen
Copy link
Member

PureWeen commented May 7, 2024

Description

While working on #22270 I noticed we are hitting a scenario that's causing an infinite layout loop.

When you look at the following stack trace we can see there's a path where

Platform Arrange happens => Sets the Frame on VisualElement => this triggers a propertychanged event on Width => propagates to handler => RequestLayout fires.

Because RequestLayout on Android fires up the whole tree this can sometimes cause weird layout loops or excessive measure/layout paths.

My current thinking is that we just need to short circuit the "Handler.Updatevalue" call inside Element if the property change is related to the readonly height/width/x/y properties and we are inside a "BatchCommitted" path.

image

I also noticed there's a rounding issue that's causing ping ponging when we update the Frame upstream so we should probably account for that as well

image

@dotnet-policy-service dotnet-policy-service bot added the s/triaged Issue has been reviewed label May 7, 2024
@PureWeen PureWeen added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter and removed s/triaged Issue has been reviewed labels May 7, 2024
@PureWeen PureWeen added this to the .NET 8 SR6 milestone May 7, 2024
@PureWeen PureWeen self-assigned this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant