-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
ListView ItemsSource refreshing problems in Windows and Android, Button double activating before DisplayAlert popup #6377
Comments
Verified repro on Android12.0 - API31 & Windows10 with VS 17.3.0 Preview 1.0 [32414.199.main]. Repro project: |
@rmarinho it seems there are more cases where views are recycled but not properly removed from their parent (at least on android).
|
@Redth this happens with ListView, works fine with CollectionView . @DavidCarKc any reason why you aren't using CollectionView? I tested your sample with collectionview on android and it works as expected. Related with your point 2nd point, this is not a bug, it's how MAUI works, you are adding items to the collection and setting the collection multiple times, but the collection object isthe same, so it won't fire that the ItemsSOurce change since it's in fact the same object (List). Can you also give me some code example for your 3rd point?! I think if it's the exception we see above it goes away if you move to CollectionView. |
@DavidCarKc about your 4th point, this is not a bug, you need to disable the button when it's tapped so it doesn't get clicked twice. About your 1st point related with windows we are going to investigate but i think is better to open a new issue just for that so we don't get confuse. Point n2 we have a fix for in a PR. Thanks |
@rmarinho 2nd point I assumed the display would be refreshed after setting the list even if it is the same list, setting it to null first is not a big problem. 3rd point: add a button and a listview in xaml, for the OnButtonClicked event add 1 object to the list and DisplayAlert if you want to display the list in ListView. If the list has less than 15 object when displaying first time and then add one more object and confirm displaying it again it will crash the app. If the list has more than 15 objects when you display it for the first time and add an object or more and thed display the list in the ListView it won't crash the app but it will take like a minute to render it on display unless if you swipe up-down. The problem with CollectionView is on Android as it won't display anything on Android if it starts with 0 item on first display. You can use the code provided in the first post for testing. 4th You are saying that Every OnButtonClicked event that has an await DisplayAlert popup should be coded as following: Maybe I'm just trying to apply logic and ideas into my apps that isn't suitable for maui. |
@rmarinho And again it didn't crash on WINDOWS even with 100+ objects displayed. BUT on ANDROID it crashes on refresh. |
Description
System.Runtime.InteropServices.COMException: '0x88000FA8'
On android app this does not happen and I tried 80 objects in list and it showed them all.
Setting a list as ItemsSource works fine first time, then if I try to add new objects to the list and then again setting the list (now with more objects) as ItemsSource the ListView will not change and will not show new objects.
This can be fixed by setting ItemsSource=null and then setting the new list as ItemsSource then it will show new objects.
On Android having 1 object shown then adding another and showing both will crash the app, same if you first show 5 and add another 5 and try to show all 10 the app will crash. BUT if you first show 15 objects and then add one or more and refresh it won't crash and will show all the objects. It is a bit strange that it will take like 1 minute to show them, they just aren't rendered to the screen because after refreshing if you swipe up-down they will show in like 3 seconds but if you don't touch the screen they won't show for a minute.
Debugger reports: Exception Unhandled
Java.Lang.IllegalStateException: ''
Also if you doubleclick very fast on the button it will activate twice ( the counter will increase by 2 which it shouldn't) there is like a 100ms delay between the click and DisplayAlert popup which blocks the rest of the app to the user where you can do another click and it will be processed by its event function. I tested it on windows and android and I can do it on both.
Steps to Reproduce
Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.2.0 Preview 4.0
Use the provided MainPage.xaml and MainPage.xaml.cs
//MainPage.xaml
//MainPage.xaml.cs
namespace MauiListViewTestRC1v172P4;
public partial class MainPage : ContentPage
{
int count = 0;
List smallList = new List();
public MainPage()
{
InitializeComponent();
}
}
public class smallObject
{
public int ID { get; set; }
public string Name { get; set; }
}
MauiListViewTestRC1v172P4.zip
Version with bug
Release Candidate 1 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
Tesed on windows 10x64 PC , Android 9.0 Phone
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: