[MAUI]I9_Scrolling_Scroll mode when adding items page throws' Java.Lang.IllegalArgumentException Message=Invalid target position' after setting UpdatingScrollMode #24272
Labels
csi-new
fixed-in-8.0.90
fixed-in-9.0.0-rc.1.24453.9
i/regression
This issue described a confirmed regression on a currently supported version
p/0
Work that we can't release without
platform/android 🤖
s/triaged
Issue has been reviewed
t/bug
Something isn't working
Milestone
Description
I9_Scrolling
Affected case:
I9_Scrolling_Scroll mode when adding items for Items UpdatingScrollMode.
Steps to Reproduce
Actual Behavior:
Detail:
◢ | $exception | {Java.Lang.IllegalArgumentException: Invalid target position at Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualVoidMethod(JniObjectReference instance, JniObjectReference type, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:line 20830 at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 75 at AndroidX.RecyclerView.Widget.RecyclerView.SmoothScrollToPosition(Int32 position) in C:\a_work\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\net6.0-android\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:line 14818 at Microsoft.Maui.Controls.Handlers.Items.ScrollHelper.AnimateScrollToPosition(Int32 index, ScrollToPosition scrollToPosition) in //src/Controls/src/Core/Handlers/Items/Android/ScrollHelper.cs:line 52 at Microsoft.Maui.Controls.Handlers.Items.MauiRecyclerView
3[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.GroupableItemsViewAdapter
2[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.IGroupableItemsViewSource, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.IGroupableItemsViewSource, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ScrollTo(ScrollToRequestEventArgs args) in //src/Controls/src/Core/Handlers/Items/Android/MauiRecyclerView.cs:line 399 at Microsoft.Maui.Controls.Handlers.Items.MauiRecyclerView3[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.GroupableItemsViewAdapter
2[[Microsoft.Maui.Controls.ReorderableItemsView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.IGroupableItemsViewSource, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Handlers.Items.IGroupableItemsViewSource, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AdjustScrollForItemUpdate() in //src/Controls/src/Core/Handlers/Items/Android/MauiRecyclerView.cs:line 587 at Microsoft.Maui.Controls.Handlers.Items.DataChangeObserver.OnItemRangeInserted(Int32 positionStart, Int32 itemCount) in //src/Controls/src/Core/Handlers/Items/Android/DataChangeObserver.cs:line 54 at AndroidX.RecyclerView.Widget.RecyclerView.AdapterDataObserver.n_OnItemRangeInserted_II(IntPtr jnienv, IntPtr native__this, Int32 positionStart, Int32 itemCount) in C:\a_work\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\net6.0-android\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:line 1124 at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V(_JniMarshal_PPII_V callback, IntPtr jnienv, IntPtr klazz, Int32 p0, Int32 p1) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 154 --- End of managed Java.Lang.IllegalArgumentException stack trace --- java.lang.IllegalArgumentException: Invalid target position at androidx.recyclerview.widget.RecyclerView$SmoothScroller.start(RecyclerView.java:12658) at androidx.recyclerview.widget.RecyclerView$LayoutManager.startSmoothScroll(RecyclerView.java:9208) at androidx.recyclerview.widget.LinearLayoutManager.smoothScrollToPosition(LinearLayoutManager.java:525) at androidx.recyclerview.widget.RecyclerView.smoothScrollToPosition(RecyclerView.java:1889) at crc645d80431ce5f73f11.DataChangeObserver.n_onItemRangeInserted(Native Method) at crc645d80431ce5f73f11.DataChangeObserver.onItemRangeInserted(DataChangeObserver.java:43) at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeInserted(RecyclerView.java:13138) at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemInserted(RecyclerView.java:8113) at mono.java.lang.RunnableImplementor.n_run(Native Method) at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) --- End of managed Java.Lang.IllegalArgumentException stack trace --- java.lang.IllegalArgumentException: Invalid target position at androidx.recyclerview.widget.RecyclerView$SmoothScroller.start(RecyclerView.java:12658) at androidx.recyclerview.widget.RecyclerView$LayoutManager.startSmoothScroll(RecyclerView.java:9208) at androidx.recyclerview.widget.LinearLayoutManager.smoothScrollToPosition(LinearLayoutManager.java:525) at androidx.recyclerview.widget.RecyclerView.smoothScrollToPosition(RecyclerView.java:1889) at crc645d80431ce5f73f11.DataChangeObserver.n_onItemRangeInserted(Native Method) at crc645d80431ce5f73f11.DataChangeObserver.onItemRangeInserted(DataChangeObserver.java:43) at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeInserted(RecyclerView.java:13138) at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemInserted(RecyclerView.java:8113) at mono.java.lang.RunnableImplementor.n_run(Native Method) at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) } | Java.Lang.IllegalArgumentExceptionLink to public reproduction project repository
https://devdiv.visualstudio.com/Pkgs/_git/VS.TestAssets.Xaml?path=/Assets/Projects/ManualMauiTests
Version with bug
8.0.90-ci.net8.24414.1
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.90-ci.net8.24413.1 & 8.0.80 & 8.0.3
Affected platforms
Android
The text was updated successfully, but these errors were encountered: