Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
XamDataGrid: IndexOutOfRangeException in SparseArray.ValidateIndex
posted

Under specific conditions (see below) I get an IndexOutOfRangeException from within the Infragistics Code (XamDataGrid). As you can see from the stack trace below, my own code is not involved when the exception occurs. The latter is thrown when data binding to one of my objects is triggered because of user interaction. The exception propagates up the entire stack and thus kills the application´s UI dispatcher (call to Application.Run at the bottom of the stack trace). The exception arises under the following conditions:

- The control´s size (especially it height) is rather large (height about 800 pixels or more)
- Grouping is used
- The number of records shown exceeds about 45.

The error arises with versions 2012.1 and 2014.2 with an identical stack trace (except the version number, of course):

System.IndexOutOfRangeException was unhandled
  HResult=-2146233080
  Message=Index was outside the bounds of the array.
  Source=InfragisticsWPF4.v12.1
  StackTrace:
       at Infragistics.Collections.SparseArray.ValidateIndex(Int32 index)
       at Infragistics.Collections.SparseArray.GetItem(Int32 index, ICreateItemCallback createItemCallback)
       at Infragistics.Collections.SparseArray.get_Item(Int32 index)
       at Infragistics.Windows.DataPresenter.FlatScrollRecordsCollection.get_Item(Int32 index)
       at Infragistics.Windows.DataPresenter.FlatScrollRecordsCollection.EnsureItemsAllocated(Int32 startIndex, Int32 count)
       at Infragistics.Windows.DataPresenter.FlatScrollRecordsCollection.EnsureItemsAllocated(GenerationCache generatorCache)
       at Infragistics.Windows.DataPresenter.FlatScrollRecordsCollection.BeginMeasure(GenerationCache generatorCache)
       at Infragistics.Windows.DataPresenter.GridViewPanelFlat.GenerationCache..ctor(GridViewPanelFlat panel, Boolean isVertical, Size constraint, Int32 overallScrollPosition, ScrollDirection scrollDirection)
       at Infragistics.Windows.DataPresenter.GridViewPanelFlat.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at BCI.Toccata.TubesWizard.StandaloneHost.App.Main() in c:\...\App.g.cs:line 50