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
625
XamDataGrid Exception: Specified argument was out of the range of valid values.
posted

 

Hello,

I'm using the InfragisticsWPF4 libraries, version 11.1.20111.2053.

I'm getting the following exception when adding large numbers of objects to a subclass instance of ObservableCollection<T> bound to a XamDataGrid:

Message:

Specified argument was out of the range of valid values.

Parameter name: index

StackTrace:

 at Infragistics.Collections.SparseArray.Insert(Int32 index, Object item)

 at Infragistics.Windows.DataPresenter.RecordCollectionBase.InsertRecord(Int32 index, Record record)

 at Infragistics.Windows.DataPresenter.RecordManager.InsertRecord(Int32 index, Int32 sortedIndex, DataRecord record, Boolean notifyListeners)

 at Infragistics.Windows.DataPresenter.RecordManager.OnSourceCollectionAddOrRemove(NotifyCollectionChangedEventArgs e)

 at Infragistics.Windows.DataPresenter.RecordManager.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)

 at Infragistics.Windows.DataPresenter.RecordManager.ProcessChangeNotification(Object sender, Object eventArgs)

 at Infragistics.Windows.DataPresenter.RecordManager.OnChangeNotification(Object sender, Object eventArgs, Boolean isReset)

 at Infragistics.Windows.DataPresenter.RecordManager.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)

 at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)

 at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)

 at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)

Other Information:

1. My collection has a reference to the System.Windows.Threading.Dispatcher associated with the UI thread.

2. My code that adds and removes items from the collection dispatches the Add() and Remove() calls to the UI thread using Dispatcher.BeginInvoke(). DispatcherPriority is "Send"

3. My collection class overrides the CollectionChanged event so that I can track subscriber handlers.

4. My collection class overrides OnCollectionChanged.  Here is where, for each subscriber handler, I call Dispatch.BeginInvoke() to execute the handler on the UI thread.  DispatcherPriority is "Send".  This is the site of the exception.  The code that executes the handler looks like this:

uiDispatcher.BeginInvoke(handlerDelegate, DispatcherPriority.Send, sender, args);

 

Summary

1. I am adding and removing items to my collection on the UI thread

2. I am dispatching collectionChanged events on the UI thread

3. To my knowledge, Dispatcher.BeginInvoke() functions in a way that, for the UI thread, calls to BeginInvoke() are executed in order.

 

Any help getting past this issue is greatly appreciated.

Thanks,

Paul