1
Vote

Crash in VirtualizingTreePanel

description

Hello,
VirtualizingTreePanel with virtualization turned on is throwing ArgumentOutOfRangeException if it is loaded with nodes collapsed and you attempt to expand a node.

Please have a look on attached VirtualizationSample that I have modified (reduced number of elements and added IsExpanded property binding)

Repro steps:
  1. Run sample
  2. Check "Virtualize items"
  3. Click Load items => two items should load
  4. Expand any of items
    =>
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in PresentationFramework.dll

Additional information: Specified index is out of range or child at index is null. Do not call this method if VisualChildrenCount returns zero, indicating that the Visual has no children.

StackTrace:
TreeViewEx.dll!System.Windows.Controls.VirtualizingTreePanel.InvalidateMeasure(System.Windows.Controls.TreeViewExItem child) Line 236 C#
TreeViewEx.dll!System.Windows.Controls.VirtualizingTreePanel.MeasureOverride(System.Windows.Size availableSize) Line 145    C#

file attachments

comments

aporosin wrote Mar 18, 2015 at 2:52 PM

I just noticed that if you increase number of elements in MainWindow.xaml.cs:
const int firstLevelCount = 20;
const int thirdLevelCount = 10;
than the same crash happens already in Step 3 (when clicking Load items )