Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Setup a ConditionalWeakTable in ListProxy to hold weak references so that a ListView will work when connected to a Weak Source #802
Description of Change
If a collection implements INotifyCollectionChanged with a Weak Reference then the ListProxy's subscription will get finalized prematurely by the GC since there are no roots holding onto the WeakProxy or the CollectionChanged subscription. I added a ConditionalWeakTable keyed on the ListProxy to hold the WeakProxy and the NotifyCollectionChangedEventHandler this way when there are no more roots holding onto ListProxy they will still get disposed. All current unit tests pass and I added an additional one that demonstrates the bug.
There shouldn't be any. When there are no more roots referencing the ListProxy the subscriptions will get cleaned up as is demonstrated by the unit tests.
It will cover your contributions to all Microsoft-managed open source projects.