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
900
IndexOutOfRangeException when dealing with selected records
posted

Hi, I have an application where a bunch of records can be selected by the user and an action performed on them.  In some cases, for some of our users, when they apply an operation that involves getting the selected items, the below exception is thrown.

In our method that gets the currently selected data records, we have some logic that makes sure the data records are of specific type, and not any of the special records, like group headers, etc...

Once the action is applied, the data types of the selected data records are updated almost immediately by a backend service.  

To the user it's a very simple operation.  Select some rows, right-click, select an action from a context menu, some server-side transaction takes place, and the selected fields are updated on their screen with the results.

Seems like the exception is thrown right after the update.  Which means that the selected items were indeed selected, but when updated, something goes wrong.  It's not reproducible all of the time.

What can cause this exception?

Unhandled exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Infragistics.Collections.SparseArray.ValidateIndex(Int32 index)
at Infragistics.Collections.SparseArray.GetItem(Int32 index, ICreateItemCallback createItemCallback)
at Infragistics.Windows.DataPresenter.FlatScrollRecordsCollection.get_Item(Int32 index)
at Infragistics.Windows.DataPresenter.FlatScrollRecordsCollection.EnsureItemsAllocated(Int32 startIndex, Int32 count)
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.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
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.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    I am just checking if you got this worked out or you still require any assistance or clarification on the matter.  

Children