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.22k stars 1.75k forks source link

[iOS] Application stucks on iOS with combination of ScrollView, StackLayout, Editor and CollectionView #14955

Open vg12345 opened 1 year ago

vg12345 commented 1 year ago

Description

MAUI application stucks on iOS with combination of ScrollView, StackLayout, Editor and CollectionView. Visual Studio version: 17.5.5 Here is the content of application main page:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MauiApp2.MainPage">

<ScrollView>
    <StackLayout>
        <Editor/>
        <CollectionView/>
    </StackLayout>
</ScrollView>

Works fine on Xamarin iOS

Attached is the sample project: MauiApp2.zip

Steps to Reproduce

  1. Run application on iOS
  2. Application stucks during loading of main page

Link to public reproduction project repository

https://github.com/dotnet/maui/files/11412465/MauiApp2.zip

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.4

Did you find any workaround?

No response

Relevant log output

No response

drasticactions commented 1 year ago

When you say "Simple Combination of Several Controls", how many involve "CollectionView". Do you have other examples? Could you make a repo rather than a zip?

My guess right now would be that it's an issue with StackView, CollectionView, and putting another control inside that. Replacing the StackView with a Grid and it works fine. I think it's doing recursion on the layout when you have it with the exact code you posted. CC @hartez

ghost commented 1 year ago

Hi @vg12345. 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.

vg12345 commented 1 year ago

As I wrote, this is exact code that causes the app to stuck:

<?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="MauiApp2.MainPage">

<ScrollView>
    <StackLayout>
        <Editor/>
        <CollectionView/>
    </StackLayout>
</ScrollView>

The example that reproduces the issue is attached. What additional info do you need?

And, yes, StackLayout can be replaces by Grid. Does it mean that this is not a problem anymore and should not be fixed? In the real application the stack does not contain just two empty controls. It contains much more, so maintaining Grid instead of StackLayout is not very suitable, when there are twenty of them and there is a need to change the order.

drasticactions commented 1 year ago

And, yes, StackLayout can be replaces by Grid. Does it mean that this is not a problem anymore and should not be fixed? In the real application the stack does not contain just two empty controls. It contains much more, so maintaining Grid instead of StackLayout is not very suitable, when there are twenty of them and there is a need to change the order.

I never said it should not be fixed, I was just suggesting that you could change it to work around your issue. And as you originally wrote "Several Controls" I wanted to know if there were more cases, so that if it was caused in different combinations all would be fixed and not just one.

I did confirm your issue, I could see that, I believe, the layout is being constantly accessed and is causing the app to not start up. I was just verifying with you if there were other cases to look for. I apologize if I wasn't clear, I'm just trying to help.

jsuarezruiz commented 1 year ago

@hartez Could be related to https://github.com/dotnet/maui/pull/14951?

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.

taublast commented 1 year ago

This could rather be related to https://github.com/dotnet/maui/issues/15189.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on iOS 16.4, not repro on Windows 11 and Android 13.0-API33 with below Project: 14955.zip