Skip to content

[iOS] When_Setting_SelectedItem_TakesEffect NSInternalInconsistencyException Reason: Attempted to scroll the collection view to an out-of-bounds item #17102

Closed

Description

@jeromelaban

Scrolling tests fail with:

ObjCRuntime.ObjCException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Attempted to scroll the collection view to an out-of-bounds item (1) when there are only 1 items in section 0. Collection view: <Microsoft_UI_Xaml_Controls_NativeListViewBase: 0x7fbf84efa000; baseClass = UICollectionView; frame = (0 0; 499.5 132); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60000355f210>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x600007d20d00>; contentOffset: {0, 0}; contentSize: {0, 44}; adjustedContentInset: {0, 0, 0, 0}; layout: <Microsoft_UI_Xaml_Controls_ItemsStackPanelLayout: 0x7fbf83929fb0>; dataSource: <Microsoft_UI_Xaml_Controls_ListViewBaseSource: 0x600003916760>>.
Native stack trace:
	0   CoreFoundation                      0x000000010982d761 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000011c1f2904 objc_exception_throw + 48
	2   Foundation                          0x0000000113aff980 _userInfoForFileAndLine + 0
	3   UIKitCore                           0x0000000133a0c1eb -[UICollectionView _validateScrollingTargetIndexPath:] + 391
	4   UIKitCore                           0x0000000133a0cd30 -[UICollectionView _contentOffsetForScrollingToItemAtIndexPath:atScrollPosition:] + 52
	5   UIKitCore                           0x0000000133a0dc46 -[UICollectionView _scrollToItemAtIndexPath:atScrollPosition:animated:] + 196
	6   libxamarin-dotnet.dylib             0x0000000105d0b5dc xamarin_dyn_objc_msgSendSuper + 220
	7   ???                                 0x000000019d63e980 0x0 + 6935538048

   at UIKit.UICollectionView.ScrollToItem(NSIndexPath indexPath, UICollectionViewScrollPosition scrollPosition, Boolean animated)
   at Uno.UI.Helpers.ListViewHelper.InstantScrollToIndex(ListViewBase lvb, Int32 index, UICollectionViewScrollPosition scrollPosition)
   at Microsoft.UI.Xaml.Controls.Primitives.Selector.OnSelectedItemChanged(Object oldSelectedItem, Object selectedItem, Boolean updateItemSelectedState)
   at Microsoft.UI.Xaml.Controls.ListViewBase.OnSelectedItemChanged(Object oldSelectedItem, Object selectedItem, Boolean updateItemSelectedState)
   at Microsoft.UI.Xaml.Controls.Primitives.Selector.OnPropertyChanged2(DependencyPropertyChangedEventArgs args)
   at Uno.UI.Controls.BindableUIView.Microsoft.UI.Xaml.IDependencyObjectInternal.OnPropertyChanged2(DependencyPropertyChangedEventArgs args)
   at Microsoft.UI.Xaml.DependencyObjectStore.InvokeCallbacks(DependencyObject actualInstanceAlias, DependencyProperty property, DependencyPropertyDetails propertyDetails, Object previousValue, DependencyPropertyValuePrecedences previousPrecedence, Object newValue, DependencyPropertyValuePrecedences newPrecedence, Boolean bypassesPropagation)
   at Microsoft.UI.Xaml.DependencyObjectStore.RaiseCallbacks(DependencyObject actualInstanceAlias, DependencyPropertyDetails propertyDetails, Object previousValue, DependencyPropertyValuePrecedences previousPrecedence, Object newValue, DependencyPropertyValuePrecedences newPrecedence)
   at Microsoft.UI.Xaml.DependencyObjectStore.InnerSetValue(DependencyProperty property, Object value, DependencyPropertyValuePrecedences precedence, DependencyPropertyDetails propertyDetails, Boolean isPersistentResourceBinding)
   at Microsoft.UI.Xaml.DependencyObjectStore.SetValue(DependencyProperty property, Object value, DependencyPropertyValuePrecedences precedence, DependencyPropertyDetails propertyDetails, Boolean isPersistentResourceBinding)
   at Microsoft.UI.Xaml.DependencyObjectStore.SetValue(DependencyProperty property, Object value)
   at Uno.UI.Controls.BindableUIView.SetValue(DependencyProperty dp, Object value)
   at Microsoft.UI.Xaml.Controls.Primitives.Selector.set_SelectedItem(Object value)
   at Microsoft.UI.Xaml.Controls.TreeViewViewModel.NotifyContainerOfSelectionChange(TreeViewNode targetNode, TreeNodeSelectionState selectionState)
   at Microsoft.UI.Xaml.Controls.SelectedTreeNodeVector.UpdateSelection(TreeViewN

Activity

  1. github-actions commented on Aug 22, 2025

    @github-actions
    Contributor

    Hey there — just a heads-up that this issue has been quiet for over a year. If there’s no update or comment in the next 10 days, it’ll be closed automatically. Feel free to remove the stale label or drop a note to keep it open.

  2. added
    stale
    on Aug 22, 2025
  3. removed
    stale
    on Aug 25, 2025
  4. MartinZikmund commented on Aug 25, 2025

    @MartinZikmund
    Member

    This is specific to native iOS, does not happen in case of Skia

  5. github-actions commented on May 2, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests.

  6. locked as resolved and limited conversation to collaborators on May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions