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.89k stars 1.69k forks source link

Moving Items between groups of a Grouped CollectionView in Android throws a IndexOutOfBoundsException #23138

Open inimirpaz opened 1 month ago

inimirpaz commented 1 month ago

Description

See repro. When moving items back and forth in a grouped collectioview in Android a

Java.Lang.IndexOutOfBoundsException has been thrown Inconsistency detected. Invalid view holder adapter positionTemplatedItemViewHolder{aaacc96 position=7 id=-1, oldPos=5, pLpos:5 scrap [attachedScrap] tmpDetached no parent} crc645d80431ce5f73f11.MauiRecyclerView_3{5d3c385 VFED..... ......I. 0,0-1080,1584}, adapter:crc645d80431ce5f73f11.ReorderableItemsViewAdapter_2@d202cd7, layout:androidx.recyclerview.widget.LinearLayoutManager@c6597f5, context:crc64dcdaa62ceb4aad7f.MainActivity@29e59f2

is thrown.

Steps to Reproduce

In the repro, try to tap on the elements which are moved to the newly created "bucket" group. Then from the "bucket" group try to tap once again to move them back, and the crash should be triggered.

Link to public reproduction project repository

https://github.com/inimirpaz/maui_issues/tree/grouped_cv_issue

Version with bug

8.0.60 SR6

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ninachen03 commented 1 month ago

I can repro this issue on Visual Studio 17.11.0 Preview 2.0 (8.0.60 &8.0.21 ), but it doesn't repro on 8.0.3 image

inimirpaz commented 1 month ago

Possible workaround: add an empty group at the end.