Hello,
I have a XamPivotGrid and some layouts that I have saved. There are 4 buttons "Test1, Test2, Test4, Test30" which when clicked, which load the layouts that I have saved. I have noticed that when clicking very frequently between buttons, the application crashes. I have added a sample to reproduce this issue, you have to launch it and then click "furiously" between buttons. It might be a little bit difficult to reproduce, but if you keep doing it, the application will crash. This is quite awkard because if our project it occurs more often and when it crashes, it's unacceptable. Can you please check into this? Thanks a lot.
I reviewed the stack trace and the exception is telling us that "an item has already been added to the collection".
This particular exception is thrown intentionally and there is no logic in our source code to stop a "loading frenzy" from happening, or to happen silently in other cases. In our particular case the load method would never add items more then once, hover there is no logic for this to ever be prevented.
May I ask why you require to change the layout very frequently?
Although there isn't a viable solution we use the following code to have the exception occur less frequently: pivotGrid.DataSource.Rows.CollectionChanging += AreaItems_CollectionChanging; pivotGrid.DataSource.Columns.CollectionChanging += AreaItems_CollectionChanging; pivotGrid.DataSource.Filters.CollectionChanging += AreaItems_CollectionChanging; pivotGrid.DataSource.Measures.CollectionChanging += AreaItems_CollectionChanging;}
private void AreaItems_CollectionChanging(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e){ AreaItemsCollection senderColl = sender as AreaItemsCollection; if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { foreach (var item in e.NewItems) { if (item is IComparable) { foreach (AreaItemsCollection filtersCollection in senderColl.UniqueGroup.Collections) { foreach (IAreaItemViewModel areaMember in filtersCollection) { IComparable member = areaMember; if (member != null && member.CompareTo(item) == 0) { senderColl.CancelCollectionChanging = true; } } } } } }}
Let me know if you have any questions.
Hello Michael,
Thank you very much for you reply, and I confirm that with this modification, the module is now much more stable, even if it still crashes sometime, but it happens less often than before. I have another major issue related to this method LoadCustomizations in this thread: http://es.infragistics.com/community/forums/p/108154/510362.aspx#510362. And this one too I think, which is not fatal but still annoying: http://es.infragistics.com/community/forums/t/108158.aspx. Right now the deadline of our project is approching and the clients are waiting for a demo, can you please take some time to look into these 2 threads too? Thank you very much!
Regards