Skip to content

[Skia] NavigationView "Index was out of range" after resizing when PaneDisplayMode="Top" #20193

Closed

Description

@TimGels

Current behavior

When using NavigationView with PaneDisplayMode="Top", it will break as soon as you select a navigation item that is put into the PopupPanel after resizing the window.

2025-05-05.20-31-02.mp4
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Microsoft.UI.Xaml.Controls.ItemsSourceView.GetAtCore(Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.Impl.cs:line 95
   at Microsoft.UI.Xaml.Controls.ItemsSourceView.GetAt(Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.cs:line 45
   at Microsoft.UI.Xaml.Controls.NavigationView.GetItemFromIndex(ItemsRepeater ir, Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs:line 5692
   at Microsoft.UI.Xaml.Controls.NavigationView.MenuItemFromContainer(DependencyObject container) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs:line 3426
   at Microsoft.UI.Xaml.Controls.NavigationView.OnRepeaterElementPrepared(ItemsRepeater ir, ItemsRepeaterElementPreparedEventArgs args) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs:line 1409
   at Microsoft.UI.Xaml.Controls.NavigationView.OnRepeaterUnoBeforeElementPrepared(ItemsRepeater itemsRepeater, ItemsRepeaterElementPreparedEventArgs args) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.Uno.cs:line 11
   at Microsoft.UI.Xaml.Controls.ItemsRepeater.OnUnoBeforeElementPrepared(UIElement element, Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeater.cs:line 1024
   at Microsoft.UI.Xaml.Controls.ViewManager.GetElementFromElementFactory(Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ViewManager.cs:line 823
   at Microsoft.UI.Xaml.Controls.ViewManager.GetElement(Int32 index, Boolean forceCreate, Boolean suppressAutoRecycle) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ViewManager.cs:line 107
   at Microsoft.UI.Xaml.Controls.ItemsRepeater.GetElementImpl(Int32 index, Boolean forceCreate, Boolean suppressAutoRecycle) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeater.cs:line 376
   at Microsoft.UI.Xaml.Controls.RepeaterLayoutContext.GetOrCreateElementAtCore(Int32 index, ElementRealizationOptions options) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/RepeaterLayoutContext.cs:line 26
   at Microsoft.UI.Xaml.Controls.VirtualizingLayoutContext.GetOrCreateElementAt(Int32 index, ElementRealizationOptions options) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/VirtualizingLayoutContext.cs:line 34
   at Microsoft.UI.Xaml.Controls.ElementManager.EnsureElementRealized(Boolean forward, Int32 dataIndex, String layoutId) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ElementManager.cs:line 261
   at Microsoft.UI.Xaml.Controls.FlowLayoutAlgorithm.Generate(GenerateDirection direction, Int32 anchorIndex, Size availableSize, Double minItemSpacing, Double lineSpacing, UInt32 maxItemsPerLine, Boolean disableVirtualization, String layoutId) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/FlowLayoutAlgorithm.cs:line 346
   at Microsoft.UI.Xaml.Controls.FlowLayoutAlgorithm.Measure(Size availableSize, VirtualizingLayoutContext context, Boolean isWrapping, Double minItemSpacing, Double lineSpacing, UInt32 maxItemsPerLine, ScrollOrientation orientation, Boolean disableVirtualization, String layoutId) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/FlowLayoutAlgorithm.cs:line 104
   at Microsoft.UI.Xaml.Controls.StackLayout.MeasureOverride(VirtualizingLayoutContext context, Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/StackLayout.cs:line 81
   at Microsoft.UI.Xaml.Controls.Layout.Measure(LayoutContext context, Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/Layout.cs:line 109
   at Microsoft.UI.Xaml.Controls.ItemsRepeater.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeater.cs:line 251
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Microsoft.UI.Xaml.Controls.ScrollContentPresenter.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs:line 215
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCell(UIElement child, CellUnitTypes rowHeightTypes, CellUnitTypes columnWidthTypes, Boolean forceRowToInfinity, Double rowSpacing, Double columnSpacing) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 498
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Int32 cellCount, Double rowSpacing, Double columnSpacing, Boolean ignoreColumnDesiredSize, Boolean forceRowToInfinity, CellCacheStackVector& cellCacheVector) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 373
   at Microsoft.UI.Xaml.Controls.Grid.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 1043
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Border.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Border/Border.Layout.cs:line 28
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Control.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs:line 463
   at Microsoft.UI.Xaml.Controls.ContentControl.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentControl/ContentControl.skia.cs:line 28
   at Microsoft.UI.Xaml.Controls.ScrollViewer.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs:line 662
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Microsoft.UI.Xaml.Controls.ItemsRepeaterScrollHost.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeaterScrollHost.cs:line 162
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.ContentPresenter.MeasureOverride(Size size) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.cs:line 1287
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Microsoft.UI.Xaml.Controls.ScrollContentPresenter.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs:line 215
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCell(UIElement child, CellUnitTypes rowHeightTypes, CellUnitTypes columnWidthTypes, Boolean forceRowToInfinity, Double rowSpacing, Double columnSpacing) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 498
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Int32 cellCount, Double rowSpacing, Double columnSpacing, Boolean ignoreColumnDesiredSize, Boolean forceRowToInfinity, CellCacheStackVector& cellCacheVector) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 373
   at Microsoft.UI.Xaml.Controls.Grid.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 1043
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Border.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Border/Border.Layout.cs:line 28
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Control.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs:line 463
   at Microsoft.UI.Xaml.Controls.ContentControl.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentControl/ContentControl.skia.cs:line 28
   at Microsoft.UI.Xaml.Controls.ScrollViewer.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs:line 662
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Control.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs:line 463
   at Microsoft.UI.Xaml.Controls.ContentControl.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentControl/ContentControl.skia.cs:line 28
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Primitives.PopupPanel.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Popup/PopupPanel.cs:line 71
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Primitives.PopupRoot.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Popup/PopupRoot.cs:line 106
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Uno.UI.Xaml.Core.RootVisual.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Internal/RootVisual.cs:line 69
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 165
   at Microsoft.UI.Xaml.UIElement.UpdateLayout() in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.cs:line 782
   at Uno.UI.Xaml.Core.CoreServices.OnTick() in /__w/1/s/src/Uno.UI/UI/Xaml/Internal/CoreServices.cs:line 102
   at Uno.UI.Dispatching.NativeDispatcher.RunAction(NativeDispatcher dispatcher, Action action) in /__w/1/s/src/Uno.UI.Dispatching/Native/NativeDispatcher.cs:line 148
05-05 20:31:29.728+02:00 E/Uno.UI.Dispatching.NativeDispatcher: NativeDispatcher unhandled exception System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Microsoft.UI.Xaml.Controls.ItemsSourceView.GetAtCore(Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.Impl.cs:line 95
   at Microsoft.UI.Xaml.Controls.ItemsSourceView.GetAt(Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.cs:line 45
   at Microsoft.UI.Xaml.Controls.NavigationView.GetItemFromIndex(ItemsRepeater ir, Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs:line 5692
   at Microsoft.UI.Xaml.Controls.NavigationView.MenuItemFromContainer(DependencyObject container) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs:line 3426
   at Microsoft.UI.Xaml.Controls.NavigationView.OnRepeaterElementPrepared(ItemsRepeater ir, ItemsRepeaterElementPreparedEventArgs args) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs:line 1409
   at Microsoft.UI.Xaml.Controls.NavigationView.OnRepeaterUnoBeforeElementPrepared(ItemsRepeater itemsRepeater, ItemsRepeaterElementPreparedEventArgs args) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.Uno.cs:line 11
   at Microsoft.UI.Xaml.Controls.ItemsRepeater.OnUnoBeforeElementPrepared(UIElement element, Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeater.cs:line 1024
   at Microsoft.UI.Xaml.Controls.ViewManager.GetElementFromElementFactory(Int32 index) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ViewManager.cs:line 823
   at Microsoft.UI.Xaml.Controls.ViewManager.GetElement(Int32 index, Boolean forceCreate, Boolean suppressAutoRecycle) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ViewManager.cs:line 107
   at Microsoft.UI.Xaml.Controls.ItemsRepeater.GetElementImpl(Int32 index, Boolean forceCreate, Boolean suppressAutoRecycle) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeater.cs:line 376
   at Microsoft.UI.Xaml.Controls.RepeaterLayoutContext.GetOrCreateElementAtCore(Int32 index, ElementRealizationOptions options) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/RepeaterLayoutContext.cs:line 26
   at Microsoft.UI.Xaml.Controls.VirtualizingLayoutContext.GetOrCreateElementAt(Int32 index, ElementRealizationOptions options) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/VirtualizingLayoutContext.cs:line 34
   at Microsoft.UI.Xaml.Controls.ElementManager.EnsureElementRealized(Boolean forward, Int32 dataIndex, String layoutId) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ElementManager.cs:line 261
   at Microsoft.UI.Xaml.Controls.FlowLayoutAlgorithm.Generate(GenerateDirection direction, Int32 anchorIndex, Size availableSize, Double minItemSpacing, Double lineSpacing, UInt32 maxItemsPerLine, Boolean disableVirtualization, String layoutId) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/FlowLayoutAlgorithm.cs:line 346
   at Microsoft.UI.Xaml.Controls.FlowLayoutAlgorithm.Measure(Size availableSize, VirtualizingLayoutContext context, Boolean isWrapping, Double minItemSpacing, Double lineSpacing, UInt32 maxItemsPerLine, ScrollOrientation orientation, Boolean disableVirtualization, String layoutId) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/FlowLayoutAlgorithm.cs:line 104
   at Microsoft.UI.Xaml.Controls.StackLayout.MeasureOverride(VirtualizingLayoutContext context, Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/StackLayout.cs:line 81
   at Microsoft.UI.Xaml.Controls.Layout.Measure(LayoutContext context, Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/Layout.cs:line 109
   at Microsoft.UI.Xaml.Controls.ItemsRepeater.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeater.cs:line 251
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Microsoft.UI.Xaml.Controls.ScrollContentPresenter.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs:line 215
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCell(UIElement child, CellUnitTypes rowHeightTypes, CellUnitTypes columnWidthTypes, Boolean forceRowToInfinity, Double rowSpacing, Double columnSpacing) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 498
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Int32 cellCount, Double rowSpacing, Double columnSpacing, Boolean ignoreColumnDesiredSize, Boolean forceRowToInfinity, CellCacheStackVector& cellCacheVector) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 373
   at Microsoft.UI.Xaml.Controls.Grid.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 1043
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Border.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Border/Border.Layout.cs:line 28
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Control.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs:line 463
   at Microsoft.UI.Xaml.Controls.ContentControl.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentControl/ContentControl.skia.cs:line 28
   at Microsoft.UI.Xaml.Controls.ScrollViewer.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs:line 662
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Microsoft.UI.Xaml.Controls.ItemsRepeaterScrollHost.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsRepeaterScrollHost.cs:line 162
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.ContentPresenter.MeasureOverride(Size size) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.cs:line 1287
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Microsoft.UI.Xaml.Controls.ScrollContentPresenter.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs:line 215
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCell(UIElement child, CellUnitTypes rowHeightTypes, CellUnitTypes columnWidthTypes, Boolean forceRowToInfinity, Double rowSpacing, Double columnSpacing) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 498
   at Microsoft.UI.Xaml.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Int32 cellCount, Double rowSpacing, Double columnSpacing, Boolean ignoreColumnDesiredSize, Boolean forceRowToInfinity, CellCacheStackVector& cellCacheVector) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 373
   at Microsoft.UI.Xaml.Controls.Grid.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs:line 1043
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Border.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Border/Border.Layout.cs:line 28
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Control.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs:line 463
   at Microsoft.UI.Xaml.Controls.ContentControl.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentControl/ContentControl.skia.cs:line 28
   at Microsoft.UI.Xaml.Controls.ScrollViewer.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs:line 662
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Control.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs:line 463
   at Microsoft.UI.Xaml.Controls.ContentControl.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/ContentControl/ContentControl.skia.cs:line 28
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Primitives.PopupPanel.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Popup/PopupPanel.cs:line 71
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.FrameworkElement.MeasureElement(UIElement view, Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.cs:line 390
   at Microsoft.UI.Xaml.Controls.Primitives.PopupRoot.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Controls/Popup/PopupRoot.cs:line 106
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 170
   at Uno.UI.Xaml.Core.RootVisual.MeasureOverride(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/Internal/RootVisual.cs:line 69
   at Microsoft.UI.Xaml.FrameworkElement.InnerMeasureCore(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/FrameworkElement.Layout.crossruntime.cs:line 327
   at Microsoft.UI.Xaml.UIElement.Measure(Size availableSize) in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs:line 165
   at Microsoft.UI.Xaml.UIElement.UpdateLayout() in /__w/1/s/src/Uno.UI/UI/Xaml/UIElement.cs:line 782
   at Uno.UI.Xaml.Core.CoreServices.OnTick() in /__w/1/s/src/Uno.UI/UI/Xaml/Internal/CoreServices.cs:line 102
   at Uno.UI.Dispatching.NativeDispatcher.RunAction(NativeDispatcher dispatcher, Action action) in /__w/1/s/src/Uno.UI.Dispatching/Native/NativeDispatcher.cs:line 148

Expected behavior

It allows me to use the Navigation View with PaneDisplayMode="Top" while resizing the screen without breaking.

How to reproduce it (as minimally and precisely as possible)

Reproduction code GitHub

NavigationViewPopupPanel_IndexOutOfRange.zip

To reproduce this issue:

  1. Launch the project
  2. Select the last or one of the last navigation view items
  3. Resize the screen so that the selected item is now hidden
  4. Open the popup panel by clicking on the three dots
    (If it didn't break already) 5. Try to resize the screen again

Workaround

N/A

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

Skia (WPF)

IDE

Visual Studio 2022

IDE version

Version 17.13.6

Relevant plugins

No response

Anything else we need to know?

No response

Activity

  1. added
    difficulty/tbd
    kind/bug
    triage/untriaged
    on May 5, 2025
  2. changed the title [-][Skia] "Index was out of range" after resizing when PaneDisplayMode="Top"[/-] [+][Skia] NavigationView "Index was out of range" after resizing when PaneDisplayMode="Top"[/+] on May 6, 2025
  3. added
    area/skia ✏️
    and removed
    triage/untriaged
    on May 9, 2025
  4. added theissue type on May 9, 2025
  5. added
    area/navigationview 🧭
    on May 9, 2025
  6. self-assigned this
    on Jul 1, 2025
  7. github-actions commented on May 12, 2026

    @github-actions
    Contributor

    This issue has had no activity for 120 days. It will be closed in 10 days if there is no further activity. Remove the Stale label or leave a comment to keep it open.

  8. added
    stale
    on May 12, 2026
  9. removed
    stale
    on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/navigationview 🧭area/skia ✏️difficulty/tbdkind/bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions