mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Issue #3290 reports a NullReferenceException inside SharpTreeNode.GetNodeByVisibleIndex, reached from a WPF virtualizing panel's measure pass. The frame is still live: the Avalonia SharpTreeView binds the TreeFlattener straight to ItemsSource, so Avalonia's virtualization indexes the same flat-list walk on every measure. Driving the model directly shows the indexer cannot walk off the end on one thread: TreeFlattener.Count and GetNodeByVisibleIndex read the same totalListLength fields with nothing in between, so a stale index becomes an ArgumentOutOfRangeException and never a null dereference. Randomized sweeps over insert/remove/expand/collapse/hide/reparent found no state where the two disagree. Only a mutation concurrent with the descent reproduces the reported frame, and every tree mutation in the app is marshalled to the UI thread. These tests pin the interleaving that the port changed: the flattened list shrinking underneath a realized index range, and a lazy subtree loading and reloading while scrolled. The first asserts the panel is actually virtualizing, so it cannot quietly degrade into a non-virtualized run that proves nothing. Assisted-by: Claude:claude-opus-5:Claude Codepull/4099/head
1 changed files with 121 additions and 0 deletions
Loading…
Reference in new issue