You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
I think the bug probably started occuring with this commit 720c25c
It only happens with ItemsUpdatingScrollMode="KeepLastItemInView"
the two other values for ItemsUpdatingScrollMode does not trigger this bug.
From the following callstack at the moment of the crash it seems
the crash appears when rendering the CarouselItemView for the first time (creation of the renderer)
during CarouselViewRenderer.UpdateItemsSource() it will call base.UpdateItemsSource() (from ItemsViewRenderer)
(this call to base.UpdateItemsSource() comes just before setting the _itemsSource on the CarouselViewLoopManager,
so until this base.UpdateItemsSource the _itemsSource in the LoopManager will remain null)
but during the call to base.UpdateItemsSource() , will at some point call UpdateItemSpacing() that will in turn call CarouselViewLoopManager.GetGoToIndex (CarouselViewRenderer.cs:721) (at this point the _itemsSource is accessed before being set to a non-null value)
(through an native android callback AndroidX.RecyclerView.Widget.RecyclerView+AdapterDataObserver.n_OnItemRangeChanged_II so maybe a little unexpected ? )
So the whole bug seems like an initialization order problem to me.
Description
[RecyclerView] Cannot scroll to position a LayoutManager set. Call setLayoutManager with a non-null argument.
The thread 0x25 has exited with code 0 (0x0).
**System.NullReferenceException:** 'Object reference not set to an instance of an object.'
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
[mono-rt] at Xamarin.Forms.Platform.Android.CarouselViewRenderer+CarouselViewLoopManager.GetGoToIndex (AndroidX.RecyclerView.Widget.RecyclerView recyclerView, System.Int32 carouselPosition, System.Int32 newPosition) [0x00013] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:721
[mono-rt] at Xamarin.Forms.Platform.Android.CarouselViewRenderer.DetermineTargetPosition (Xamarin.Forms.ScrollToRequestEventArgs args) [0x0004a] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:59
[mono-rt] at Xamarin.Forms.Platform.Android.CarouselViewRenderer.ScrollTo (Xamarin.Forms.ScrollToRequestEventArgs args) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:204
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].AdjustScrollForItemUpdate () [0x00013] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:668
[mono-rt] at Xamarin.Forms.Platform.Android.DataChangeObserver.OnItemRangeChanged (System.Int32 positionStart, System.Int32 itemCount) [0x00008] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\DataChangeObserver.cs:59
[mono-rt] at AndroidX.RecyclerView.Widget.RecyclerView+AdapterDataObserver.n_OnItemRangeChanged_II (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 positionStart, System.Int32 itemCount) [0x00008] in D:\a\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\monoandroid9.0\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:1061
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V (_JniMarshal_PPII_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.Int32 p0, System.Int32 p1) [0x00005] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:154
[mono-rt] at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V(intptr,intptr,int,int)
[mono-rt] at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_void_method_a(intptr,intptr&,intptr,intptr,intptr,intptr)
[mono-rt] at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00058] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:12320
[mono-rt] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00065] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:75
[mono-rt] at AndroidX.RecyclerView.Widget.RecyclerView+AdapterDataObserver.OnItemRangeChanged (System.Int32 positionStart, System.Int32 itemCount, Java.Lang.Object payload) [0x00050] in D:\a\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\monoandroid9.0\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:1106
[mono-rt] at Xamarin.Forms.Platform.Android.DataChangeObserver.OnItemRangeChanged (System.Int32 positionStart, System.Int32 itemCount, Java.Lang.Object payload) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\DataChangeObserver.cs:64
[mono-rt] at AndroidX.RecyclerView.Widget.RecyclerView+AdapterDataObserver.n_OnItemRangeChanged_IILjava_lang_Object_ (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 positionStart, System.Int32 itemCount, System.IntPtr native_payload) [0x00011] in D:\a\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\monoandroid9.0\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:1092
[mono-rt] at (wrapper delegate-invoke) <Module>.invoke_void_intptr_intptr_int_int_intptr(intptr,intptr,int,int,intptr)
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPIIL_V (_JniMarshal_PPIIL_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.Int32 p0, System.Int32 p1, System.IntPtr p2) [0x00005] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:253
[mono-rt] at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPIIL_V(intptr,intptr,int,int,intptr)
[mono-rt] at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_void_method_a(intptr,intptr&,intptr,intptr,intptr,intptr)
[mono-rt] at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00058] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:12320
[mono-rt] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001a] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:93
[mono-rt] at AndroidX.RecyclerView.Widget.RecyclerView+Adapter.NotifyItemChanged (System.Int32 position) [0x00018] in D:\a\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\monoandroid9.0\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:419
[mono-rt] at Xamarin.Forms.Platform.Android.CarouselViewRenderer.UpdateItemSpacing () [0x00019] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:194
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].UpdateLayoutManager () [0x00024] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:628
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].UpdateEmptyViewVisibility () [0x000d1] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:660
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].UpdateEmptyView () [0x0011b] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:534
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].UpdateItemsSource () [0x00048] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:267
[mono-rt] at Xamarin.Forms.Platform.Android.CarouselViewRenderer.UpdateItemsSource () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:152
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].SetUpNewElement (TItemsView newElement) [0x00053] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:316
[mono-rt] at Xamarin.Forms.Platform.Android.CarouselViewRenderer.SetUpNewElement (Xamarin.Forms.ItemsView newElement) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:94
[mono-rt] at Xamarin.Forms.Platform.Android.ItemsViewRenderer`3[TItemsView,TAdapter,TItemsViewSource].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0004f] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemsViewRenderer.cs:104
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:358
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000b3] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:140
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:351
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:112
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:481
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:244
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:358
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000b3] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:140
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:351
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:112
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:481
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:244
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:358
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000b3] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:140
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:351
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:112
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:481
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:244
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:358
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000b3] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:140
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:351
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:112
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:481
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:244
[mono-rt] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, AndroidX.Fragment.App.FragmentManager fragmentManager, Android.Content.Context context) [0x00031] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:404
[mono-rt] at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00008] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:57
[mono-rt] at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00021] in D:\a\1\s\generated\androidx.fragment.fragment\obj\Release\monoandroid9.0\generated\src\AndroidX.Fragment.App.Fragment.cs:1977
[mono-rt] at (wrapper delegate-invoke) <Module>.invoke_intptr_intptr_intptr_intptr_intptr_intptr(intptr,intptr,intptr,intptr,intptr)
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L (_JniMarshal_PPLLL_L callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0, System.IntPtr p1, System.IntPtr p2) [0x00005] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:352
[mono-rt] at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L(intptr,intptr,intptr,intptr,intptr)
crashing (uncaught NullReference during Renderer stuff)
Basic Information
Version with issue: 2478 and following
Last known good version:2401
Platform Target Frameworks:
Android:
Android Support Library / AndroidX Version:
NuGet Packages:
Affected Devices:
Environment
Show/Hide Visual Studio info
Microsoft Visual Studio Community 2022
Version 17.7.4
VisualStudio.17.Release/17.7.4+34031.279
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA788
Microsoft Visual C++ 2022
ASP.NET and Web Tools 17.7.273.65229
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.7.273.65229
Azure App Service Tools v3.0.0
C# Tools 4.7.0-3.23416.8+43b0b05cc4f492fd5de00f6f6717409091df8daa
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Extensibility Message Bus 1.4.34 (main@d5ab18b)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.7.27 (547ea6f)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.7.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.7.3.2333001+0ab18affdf2a37647768d0e25f5f021bee6257a1
Provides languages services for ASP.NET Core Razor.
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 17.0.20829.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.7.0-3.23416.8+43b0b05cc4f492fd5de00f6f6717409091df8daa
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.7.0-beta.23314.10+e612cf93b989503c89e3a5830090062b7ab5e143
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.7.0.216 (d17-7@133ddef)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.7.3.9 (remotes/origin/d17-7@796d191def)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.7.21 (150ec9f)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.2.1.2 (d17-5/a8a26c7)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d
Xamarin.iOS and Xamarin.Mac SDK 16.4.0.15 (8c3876d5e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
tmijieux
changed the title
[Bug] crash when first displaying a carousel view on android [Draft issue]
[Bug] crash when first displaying a carousel view on android
Oct 2, 2023
tmijieux
changed the title
[Bug] crash when first displaying a carousel view on android
[Bug] crash when first displaying a carousel view on android with ItemsUpdatingScrollMode="KeepLastItemInView"
Oct 2, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think the bug probably started occuring with this commit 720c25c
It only happens with ItemsUpdatingScrollMode="KeepLastItemInView"
the two other values for ItemsUpdatingScrollMode does not trigger this bug.
From the following callstack at the moment of the crash it seems
the crash appears when rendering the
CarouselItemView
for the first time (creation of the renderer)during
CarouselViewRenderer.UpdateItemsSource()
it will callbase.UpdateItemsSource()
(fromItemsViewRenderer
)(this call to
base.UpdateItemsSource()
comes just before setting the_itemsSource
on theCarouselViewLoopManager
,so until this
base.UpdateItemsSource
the_itemsSource
in theLoopManager
will remain null)but during the call to base.UpdateItemsSource() , will at some point call UpdateItemSpacing() that will in turn call
CarouselViewLoopManager.GetGoToIndex
(CarouselViewRenderer.cs:721) (at this point the _itemsSource is accessed before being set to a non-null value)(through an native android callback
AndroidX.RecyclerView.Widget.RecyclerView+AdapterDataObserver.n_OnItemRangeChanged_II
so maybe a little unexpected ? )So the whole bug seems like an initialization order problem to me.
Description
Steps to Reproduce
Expected Behavior
not crashing
Actual Behavior
crashing (uncaught NullReference during Renderer stuff)
Basic Information
Environment
Show/Hide Visual Studio info
Build Logs
Screenshots
Reproduction Link
https://github.com/tmijieux/xamforms_carousel_crash
Workaround
using the default value for ItemsUpdatingScrollMode (although it may have a different behavior)
also downgrading to 2401 also works
The text was updated successfully, but these errors were encountered: