Dec 23, 2010 at 6:53 PM
Edited Dec 23, 2010 at 6:54 PM
We've been spiking with your sample solution and reached the same conclusion. You could extend the
CompositePresentationEvent to allow a subscription that can notify exceptions that could happen on the background thread, by providing an event handler for the
The code for the aforementioned event handler could look like this:
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
Additionally, it could be helpful to remark that in Prism v4, the behavior for the
InvokeAction method of the BackgroundEventSubscription class has been modified. The current
InvokeAction method queues the delegate you're pointing to to the thread pool. To illustrate what I'm saying, here's the code for the method:
public override void InvokeAction(Action<TPayload> action, TPayload argument)
ThreadPool.QueueUserWorkItem( (o) => action(argument) );
Using this mechanism, we've found that exceptions thrown on the delegate provided to a background event subscription are forwarded accordingly.
I hope you find this helpful.
Guido Leandro Maliandi