-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] [iOS] CollectionView iOS inner crash while adding items to group, items aren't displayed #13268
Comments
This is happening in Xamarin Forms 5.0.0.1829-pre6 as well. Code was previously working on older versions of Xamarin <= 4.8.0.1687. This is only triggered with IsGrouped="True" |
Bind your list after the for statement. If you add itens to your list as you bind it to your collectionView the app is going to crash |
I think issue with ObservableCollection. Generic List works on iOS on XF>4.8.0.1687, but it doesn't bind CollectionView IsGrouped on Android. ObservableCollection is important part of MVVM, it should be fixed. Downgraded XF 4.8.1687 for working on both platforms for now. |
@kgouraw nope, the problem inside the synchronizer. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I was actually able to work around this issue by using the ObservableRangeCollection and using it's AddRange() method. |
Let's try by AddRange. I will write how the results will be. |
The result is negative. Did not help. Let's try to think of another solution. |
@RenatGaliew try to use dynamic data |
@bondarenkod my data is already dynamic, once the data is loaded everything is fine, then after switching to another page and returning to the current one, an error crashes and nothing more will be added, it crashes on the add method |
I am seeing the same thing, and I am also using the Dynamic Data package to operate the collection. |
@RenatGaliew oh, sorry, I meant this https://github.com/reactivemarbles/DynamicData |
This comment was marked as off-topic.
This comment was marked as off-topic.
Seems like some people reported this as still not working unfortunately. |
Everyone still experiencing this and watching this issue, a PR for this is open now, would you be able to grab the NuGet as described here and let us know if this fixes this issue? That will greatly speed up the review process. Make sure to take the exact version number that is listed on the PR. Besides verifying if this particular issue is fixed also be sure to check other scenarios in the same area to make sure that this fix doesn't accidentally has side-effects 🙂 Thanks! |
Anyone able to test this? |
@jfversluis I've been working with a customer who is still seeing this issue. They have helped create a repro sample app which consistently crashes |
I'm sorry guys, I'm currently closing release, so I'm not able to pay any attention to this issue nor this or the next week. |
@jfversluis I have tested the PR. My problems with the CollectionView were solved with it! |
@jfversluis ?? Where to find the NuGet? Nothing in the DevOps artifact. Sorry. I am newbie, may be making a stupid mistake. |
You have to add an additional package source (https://aka.ms/forms-prs/index.json), then the NuGet will be found. |
@jfversluis Super! Your PR appears fixing my issue too. Another quick advice please. What can I do, in order to be notified when this particular PR is merged into an official release? |
I have downgraded the Xamarin Forms version to 5.0.0.7396 as advised Gerald by using given package source (https://aka.ms/forms-prs/index.json) but still my issue is occurring. below is exception Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (1), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted). Collection view: <UICollectionView: 0x7f82c23fe200; frame = (0 0; 388 452); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600002fdefd0>; layer = <CALayer: 0x6000067ef700>; contentOffset: {0, 0}; contentSize: {388, 204.99999999999994}; adjustedContentInset: {0, 0, 0, 0}; layout: <Xamarin_Forms_Platform_iOS_ListViewLayout: 0x7f82c17d7070>; dataSource: <Xamarin_Forms_Platform_iOS_GroupableItemsViewController_1: 0x7f82c3837810>> Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (1), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted). Collection view: <UICollectionView: 0x7f82c23fe200; frame = (0 0; 388 452); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600002fdefd0>; layer = <CALayer: 0x6000067ef700>; contentOffset: {0, 0}; contentSize: {388, 204.99999999999994}; adjustedContentInset: {0, 0, 0, 0}; layout: <Xamarin_Forms_Platform_iOS_ListViewLayout: 0x7f82c17d7070>; dataSource: <Xamarin_Forms_Platform_iOS_GroupableItemsViewController_1: 0x7f82c3837810>> |
@ikettansinha The correct version of Gerald is XF 5.0.0.8268. Version 5.0.0.7396 is only chosen as an example in the description. The correct version can be found in the linked pull request #15439. |
@SEngelsKTS It solved the issue thanks you very much for the prompt response. |
It stops crushing indeed. But the scrolling gets very slow, actually unusable. So I went back to official latest package, abandoned ObservableObjects, and have List instead. |
Hi @kazutsugu So now you are using simple list as item source for your collection view? |
Same Happening now. Scrolling is not usable now |
Yes. If I understand correctly, this issues comes in the combination of CollectionView grouping enabled and ObservableObjects. I saw in a sample code provided by MS that for CollectionView grouping enabled, it is actually List is used. |
This solves the issue in my case. Thanks. |
Hi I ran into the same issue. Here is a great workaround for this problem. This one worked for me and got some benefits sorting the list |
This comment was marked as off-topic.
This comment was marked as off-topic.
do we know what is causing the issue ? ` var subject = new SourceCache<Subject, long>(s => s.Id);
|
@draganDBL
I heavily rely on DynamicData for some fresh features in my projects.
This gives me possibility to have all the grouping features except native features like sticky scrolling, etc. |
Hello @bondarenkod still the same same exception happens. |
Hello @bondarenkod I have added
and this fix my issued when I have tested on real device and no more exception. Thank you |
Description
I was testing the latest build of XamarinForms when I realized that there is an issue related to a group's item manipulation on the iOS platform. I can't reproduce this error on the Android platform.
I've also tried to use
ObservableRangeCollection
without any noticeable difference from the defaultObservableCollection
.There are also a few lines of iOS inner exception message:
Full output log is here
02_01_2021__14_40_13__e09b3d8b-4a6c-4d31-b7c0-9f047d3c1dfa.txt
I will add any additional info if needed.
Steps to Reproduce
If you are using my demo project:
Expected Behavior
Added items are presented (visible) on the screen.
Actual Behavior
Added items aren't presented (visible) on the screen. You can see the exception in the VS's output window.
Basic Information
Environment
not applicable
Build Logs
not applicable
Screenshots
Good result (XF 4.8.0.1687):
https://user-images.githubusercontent.com/3184414/103457346-2ec98280-4d07-11eb-81e1-caabdf11bce0.mp4
Bad result (XF 4.8.0.1821):
https://user-images.githubusercontent.com/3184414/103457371-6df7d380-4d07-11eb-8916-0615bedaae21.mp4
Reproduction Link
https://github.com/bondarenkod/xf_cv_group_add_range_bug
Workaround
Downgrade to Xamarin.Forms 4.8.0.1687
The text was updated successfully, but these errors were encountered: