reactiveui/ReactiveUI — pull request #523 by paulcbetts (2014-02-18 22:54:55+00:00)
Title: ReactiveList.ItemChanged must be scheduled

Consider the following code:

```cs
var makeSomeToasters = Enumerable.Range(0,5).Select(_ => new Toaster());
void listOfToasters = new ReactiveList(makeSomeToasters) {
ChangeTrackingEnabled = true,
};

void listOfAvailableToasters = listOfToasters.CreateDerivedCollection(
x => new ToasterViewModel(x),
x => x.IsToasting == false);

// On other threads, start fiddling with Toasters. Note that since we're not
// touching the *same* object on multiple threads and we're not bound to the
// UI yet, this is a reasonable proposition. We're also only *reading* from
// the source collection, which is also reasonable from a thread safety
// perspective.
//
// Also, while this example is contrived, it may be entirely reasonable /
// non-obvious in a large application

var someTasks = Enumerable.Range(0,4)
.Select(x => Task.Run(() => listOfToasters[x].IsToasting = true)));

// :boom: => "Collection is modified, enumerator cannot continue", because
// listOfAvailableToasters is now iterating through listOfToasters on multiple
// threads trying to update itself.
Task.WaitAll(someTasks);
```

Attempting to reason about `ItemChanged` when it is spitting out notifications on arbitrary threads is Problematic™.