2
Vote

Asynchronous iterator dependencies accessed from background threads

description

When using the Asynchronous iterator like this:
 
foo.AsBindable().Where(c => c.Name.StartsWith("F")).Asynchronous();
 
The dependency will in some cases be resolved on the asynchronous background thread. If the dependency were a WPF or Windows Forms control, this will probably result in an exception. The workaround is that any queries with dependencies should go after the Asynchronous operator:
 
foo.AsBindable().Asynchronous().Where(c => c.Name.StartsWith("F"));
 
A more "correct" approach would be to access the dependency values on the foreground thread. However, I think coordinating this in code might be a lot of effort for scenarios that aren't really common. I'm looking for feedback from the community as to whether this should be attacked.

comments