Bug in ClearSubscriptions?

Apr 25, 2012 at 7:10 PM


I had a situation where I had one item in an ObservableCollection that was being used in a CLINQ expression. I cleared the ObservableCollection, then re-added that same item. I got an exception in NotifyCollectionChangedMonitor.SubscribeToItem at the line that says:

   this.Subscriptions.Add(item, subscriptionTree);

The exception was that the key already exists, and sure enough, 'item' was already in the Subscriptions dictionary.

If I changed the Clear of my ObservableCollection to a RemoveAt(0), then re-added the item, CLINQ worked fine.

When I do the RemoveAt, NotifyCollectionChangedMonitor.UnsubscribeFromItem gets called and it has a line that says:


But if I call Clear instead of RemoveAt, NotifyCollectionChangedMonitor.ClearSubscriptions is called and it does not appear to clear the Subscriptions dictionary.

Is this a bug?


   Bob Alexander