Hi,
I am binding my XamDataGrid to an observable collection. When there is a change, I switch to UI thread and post a collection change event. Sporadically, I have seen an exception deep inside RecordManager:
Exception Details
=================
System.NullReferenceException:Object reference not set to an instance of an object.
at Infragistics.Windows.DataPresenter.RecordManager.ProcessQueuedChangeNotifications(Boolean calledFromDelayedChange)
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)
at
I don't know how to reproduce this and it happens frequently for a few users so could someone help me diagnose what went wrong? and how to avoid this?
Thank you
Do you mean that you are switching to the UI thread and changing the collection there or are you just changing the collection on the background thread and only switching to the UI thread to send the change notification? If you are changing the collection on the background thread you can still cause race conditions (such as the intermittent exceptions you mention) because the grid or any other object with access to the collection could be accessing/manipulating/enumerating the collection while you are changing it on the background thread or even after you change it but before the change notification is sent. You really have to change the collection on the UI thread or keep a copy of the collection on the ui thread that isn't manipulated and have it synchronize itself with the changed collection when it gets the collection change notification on the UI thread.
Hi Andrew,
Yes, my collection is doing all operations on the UI thread. As data comes in, I switch to UI thread, add/remove items then post the events. I will try switching to a normal ObservableCollection to see if that helps.
Hi backvudao,
I am following up with you to determine if switching to a normal ObservableColleciton has resolved this issue.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
I got the same crash in v15.1.2038. Just simple property changed notification and it happened randomly - There is definitely an issue
at Infragistics.Windows.DataPresenter.RecordManager.ProcessQueuedChangeNotifications(Boolean calledFromDelayedChange) at Infragistics.Windows.DataPresenter.RecordManager.OnChangeNotification(Object sender, Object eventArgs, Boolean isReset, Boolean isCellChangeNotification) at Infragistics.Windows.DataPresenter.DataRecord.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e) at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Listener& listener, Object sender, EventArgs args, Type managerType) at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType) at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list) at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)