RadTreeView Index out of range when try to expand node

0 Answers 16 Views
TreeView
Deltaohm
Top achievements
Rank 1
Iron
Deltaohm asked on 01 Jul 2021, 07:18 AM | edited on 01 Jul 2021, 08:15 AM

Hi.
I get Index out of range when try to expand node in my RadTreeview.

I expand and select two items,
Then I try to expand a different node (same root but different branch) and I get the error:

System.IndexOutOfRangeException
  HResult=0x80131508
  Message=Index was outside the bounds of the array.
  Source=Telerik.Windows.Controls.Navigation
  StackTrace:
   at Telerik.Windows.Controls.TreeView.IndexTree.CumulativeValue(Int32 endIndex)
   at Telerik.Windows.Controls.TreeView.TreeViewPanel.ExtendDesiredSize(ItemsControl itemsControl, Size stackDesiredSize, Int32 pivotIndex, Boolean before)
   at Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in /_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/FrameworkElement.cs:line 4406
   at System.Windows.UIElement.Measure(Size availableSize) in /_/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/UIElement.cs:line 658
   at System.Windows.ContextLayoutManager.UpdateLayout() in /_/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/LayoutManager.cs:line 315
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) in /_/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/LayoutManager.cs:line 583
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() in /_/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MediaContext.cs:line 1968
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) in /_/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MediaContext.cs:line 1845
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) in /_/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MediaContext.cs:line 1746
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 137
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 46
   at System.Windows.Threading.DispatcherOperation.InvokeImpl() in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherOperation.cs:line 549
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Internal/CulturePreservingExecutionContext.cs:line 216
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 215
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Internal/CulturePreservingExecutionContext.cs:line 183
   at System.Windows.Threading.DispatcherOperation.Invoke() in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherOperation.cs:line 455
   at System.Windows.Threading.Dispatcher.ProcessQueue() in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 2105
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 2340
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndWrapper.cs:line 330
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndSubclass.cs:line 433
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 137
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 46
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 1342
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndSubclass.cs:line 378
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 2135
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 329
   at System.Windows.Threading.Dispatcher.Run() in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 297
   at System.Windows.Application.RunDispatcher(Object ignore) in /_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs:line 2405
   at System.Windows.Application.RunInternal(Window window) in /_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs:line 1695
   at System.Windows.Application.Run() in /_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs:line 198
   at NsModules.App.Main()

  This exception was originally thrown at this call stack:
    Telerik.Windows.Controls.TreeView.IndexTree.CumulativeValue(int)
    Telerik.Windows.Controls.TreeView.TreeViewPanel.ExtendDesiredSize(System.Windows.Controls.ItemsControl, System.Windows.Size, int, bool)
    Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(System.Windows.Size)
    System.Windows.FrameworkElement.MeasureCore(System.Windows.Size) in FrameworkElement.cs
    System.Windows.UIElement.Measure(System.Windows.Size) in UIElement.cs
    System.Windows.ContextLayoutManager.UpdateLayout() in LayoutManager.cs
    System.Windows.ContextLayoutManager.UpdateLayoutCallback(object) in LayoutManager.cs
    System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() in MediaContext.cs
    System.Windows.Media.MediaContext.RenderMessageHandlerCore(object) in MediaContext.cs
    System.Windows.Media.MediaContext.RenderMessageHandler(object) in MediaContext.cs
    ...
    [Call Stack Truncated]

 

If I invert the order of selection the error don't raise.

In the figure: first I select the node in yellow, then I click in the arrow in red

 

Martin Ivanov
Telerik team
commented on 02 Jul 2021, 10:18 AM

This error was reported previously, but we weren't able to reproduce it on our side. What you can check is if you have any multithreading code in your application that relates to the RadTreeView control. Also, I would recommend you to share a runnable project that reproduces the issue. 

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Deltaohm
Top achievements
Rank 1
Iron
Share this question
or