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

[Android] App crashes when changing tabs in Shell TabBar #17568

Open
RandomMauiDev opened this issue Sep 22, 2023 · 6 comments
Open

[Android] App crashes when changing tabs in Shell TabBar #17568

RandomMauiDev opened this issue Sep 22, 2023 · 6 comments
Labels
area-controls-listview ListView and TableView platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@RandomMauiDev
Copy link

RandomMauiDev commented Sep 22, 2023

Description

App is using AppShell + TabBar with two tabs.
Inside one tab there is a button that opens up a new page in the tab.
On that page I have a ListView with around 50 items (any number that would cause ListView's scroll to be junky would do), and items are a bit complex, but not too much.
ViewCell visual tree is as follows:

<Border><Grid>
    <Image />
    <VerticalStackLayout>
        <Label />
        <HorizontalStackLayout>
            <Label />
            <Label />
            <Label />
            <Label />
        </HorizontalStackLayout>
        <HorizontalStackLayout>
            <Label />
            <Label />
            <Label />
        </HorizontalStackLayout>
    </VerticalStackLayout>
</Grid></Border>

Basically a shopping list item with a image, and name/price/discount etc. etc.
These labels could have been replaced by FormattedString and Span-s, but doing so makes the ListView scroll super slow.

Swapping tabs between this page with the ListView and some other tab, while also scrolling the ListView fast will cause the app to crash after doing so for 5-6 times (maybe more, depends).

Error on crash:

JNI DETECTED ERROR IN APPLICATION: JNI CallObjectMethodA called with pending exception java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

I also reported another issue regarding a page in a TabBar's tab:
#17566
I think they might be related, feels like the page in the tab gets "reset" somehow when swapping tabs.

This issue is a blocker for the app I am working on so any help or workaround would be appreciated.

Steps to Reproduce

  1. Create AppShell with 2 or more tabs in TabBar
  2. Create a button to open a new page inside a tab
  3. Add ListView to that page with a bit complex ItemTemplate
  4. Scroll the ListView fast up & down and change tabs back and forth.
  5. Repeat step 4. multiple times until the app crashes with the error mentioned in description.

Link to public reproduction project repository

https://github.com/RandomMauiDev/MauiAndroidListViewBug

Version with bug

7.0.92

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No.

Relevant log output

No response

@RandomMauiDev RandomMauiDev added the t/bug Something isn't working label Sep 22, 2023
@RandomMauiDev
Copy link
Author

Here is a reproduction video:
https://www.youtube.com/shorts/97WlCBfaz-Q

@ghost
Copy link

ghost commented Sep 22, 2023

Hi @RandomMauiDev. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

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.

@drasticactions
Copy link
Contributor

If you could create a small reproduction project, that will make it easier for anyone to debug and diagnose and make sure we're working on the same issue at hand. I know it can be a pain, but it really helps a lot to do.

@RandomMauiDev
Copy link
Author

RandomMauiDev commented Sep 22, 2023

Here is the reproduction project:
https://github.com/RandomMauiDev/MauiAndroidListViewBug

You can also see here that the ListView scrolling is really slow. It could be because of a lot of labels used, but using single label with FormattedString and Spans is even slower.

When you scroll up and down and switch tabs fast it can also happen that the page completely disappears.
Doing it again and again causes the app to crash.

I think it has something to do with page "resetting" or "reloading" when you change tabs.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Sep 22, 2023
@PureWeen PureWeen added area-controls-listview ListView and TableView and removed s/needs-attention Issue has more information and needs another look labels Sep 22, 2023
@PureWeen PureWeen added this to the Backlog milestone Sep 22, 2023
@ghost
Copy link

ghost commented Sep 22, 2023

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.

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Feb 27, 2024
@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio 17.10.0 Preview 1. Can repro on Android platform with sample project.
https://github.com/RandomMauiDev/MauiAndroidListViewBug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-listview ListView and TableView platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants