You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support Bulk Operations in ListCollectionView via ObservableCollection<T> #1887
The net effect here is that a common helper method that is used in many WPF apps (AddRange to an ObservableCollection<T> no longer binds and the replacement method's behavior has a negative and observable side effect.
Adding issue for .NET 5 consideration
Reacted by Tobias Käs, Rob LaDuca, Vatsan Madhavan, Bastian Schmidt, Chase Florell, Pedro Jesus, Matvei Stefarov, Maximilian Haru Raditya, Luis von der Eltz, Shimmy Weitzhandler and 54 more
Reacted by Tobias Käs, Bastian Schmidt, Skye Hoefling, Shimmy Weitzhandler, Rand-Random, Dzmitry Panamarenka, Jan Ivar Carlsen, Amr, kronic, Max Katz and 2 more
This is actually a longstanding bug in WPF, throwing from a INotifyCollectionChanged event handler is not allowed, you are consuming the events and are not in control of the origin. Correct implementation would be to fall back to the Reset case when you encounter a situation you cannot handle.
The usual workaround is to put a proxy between WPF and the event source, to translate events WPF doesn't understand into reset events.
I'd just like to say that as much as I'd love if this weren't an issue, as the publisher of a commerical WPF app I'd be a bit apprehensive of the possibility of side effects from this. We saw how easily relatively modest changes to OC broke existing code because of all the extension methods people had implemented over the years to get around this issue; we don't know what other code is out there that assumes the behavior that might be changing if this were implemented across the framework.
I'm thinking generally of the possibility of controls that code assumes will fire multiple events in response to serial collection changes suddenly firing only one such event. SelectionChanged events and things of that nature, for example. But it's the unknown unknowns that I'd be even more concerned about.
Certainly range methods can be added to ObservableCollection - or perhaps better yet a new collection type altogether that fully implements INCC - without creating the same unintended issues the original approach did as long as steps are taken to ensure they aren't inadvertently used with WPF. I would consider the possibility of a more conservative approach before doing something that could potentially impact the behavior of a large section of this 15 year old framework.
Activity
weltkante commentedon Sep 13, 2019
This is actually a longstanding bug in WPF, throwing from a INotifyCollectionChanged event handler is not allowed, you are consuming the events and are not in control of the origin. Correct implementation would be to fall back to the
Resetcase when you encounter a situation you cannot handle.The usual workaround is to put a proxy between WPF and the event source, to translate events WPF doesn't understand into reset events.
vatsan-madhavan commentedon Sep 13, 2019
/cc @karelz, @robertmclaws
michael-hawker commentedon Oct 20, 2021
Related to #52
robertmclaws commentedon Oct 20, 2021
YES! Let's finally get this done for 7.0!!!
SkyeHoefling commentedon Oct 21, 2021
Should I try and grab the old code I originally PRed from a few years ago and submit a new PR to dotnet/runtime?
legistek commentedon Nov 7, 2021
I'd just like to say that as much as I'd love if this weren't an issue, as the publisher of a commerical WPF app I'd be a bit apprehensive of the possibility of side effects from this. We saw how easily relatively modest changes to OC broke existing code because of all the extension methods people had implemented over the years to get around this issue; we don't know what other code is out there that assumes the behavior that might be changing if this were implemented across the framework.
I'm thinking generally of the possibility of controls that code assumes will fire multiple events in response to serial collection changes suddenly firing only one such event.
SelectionChangedevents and things of that nature, for example. But it's the unknown unknowns that I'd be even more concerned about.Certainly range methods can be added to
ObservableCollection- or perhaps better yet a new collection type altogether that fully implements INCC - without creating the same unintended issues the original approach did as long as steps are taken to ensure they aren't inadvertently used with WPF. I would consider the possibility of a more conservative approach before doing something that could potentially impact the behavior of a large section of this 15 year old framework.