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.86k stars 1.68k forks source link

FlexLayout - Layout cycle detected. Layout could not complete. #21898

Open DominikErnst opened 3 months ago

DominikErnst commented 3 months ago

Description

Layout cycle detected. Layout could not complete.

Steps to Reproduce

  1. Create an MAUI App $(TargetFrameworks);net8.0-windows10.0.19041.0
  2. Replace MainPage.xaml with follwing code, except x:Class="FlexLayoutTest.MainPage"

`<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="FlexLayoutTest.MainPage">

<ScrollView>
    <Grid RowDefinitions="Auto, Auto, *" ColumnDefinitions="*,*,*" >
        <FlexLayout Grid.Row="0" Direction="Row" Wrap="Wrap" JustifyContent="Center" AlignItems="Center" >
            <Image
            Source="dotnet_bot.png"
            HeightRequest="185"
            Aspect="AspectFit"
            SemanticProperties.Description="dot net bot in a race car number eight" />

            <Label
            Text="Hello, World!"
            Style="{StaticResource Headline}"
            SemanticProperties.HeadingLevel="Level1" />

            <Label
            Text="Welcome to &#10;.NET Multi-platform App UI"
            Style="{StaticResource SubHeadline}"
            SemanticProperties.HeadingLevel="Level2"
            SemanticProperties.Description="Welcome to dot net Multi platform App U I" />

            <Button
            x:Name="CounterBtn"
            Text="Click me" 
            SemanticProperties.Hint="Counts the number of times you click"
            Clicked="OnCounterClicked"
            HorizontalOptions="Fill" />

        </FlexLayout>
    </Grid>
</ScrollView>

`

  1. Run the App
  2. Resize the Window to smallest possible and then make it bigger
  3. Enjoy the Exception "Layout cycle detected. Layout could not complete."

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

NO

Relevant log output

No response

RoiChen001 commented 3 months ago

Can repro this issue at Windows platform on the latest 17.10.0 Preview 4(8.0.7&8.0.20). Exc

EPS-Lac commented 2 months ago

This happens to me even without resizing the window. When I (dynamically) set the AlignItems or AlignSelf to either Center or End this exception is thrown.

DavidLiu642874264 commented 1 month ago

This happens to me when i use the Flexlayout. So i replace the FlexLayout by StackLayout. I think the FlexLayout also need to be fixed!

jsuarezruiz commented 1 month ago

Could have been fixed by https://github.com/dotnet/maui/pull/22411 Could you try the latest nightly?

dotnet-policy-service[bot] commented 1 month ago

Hi @DominikErnst. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

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.