I have a question about threading in Silverlight. I come mainly from a winForms background and usually use the following wrapper class to do my threading:
http://msdn.microsoft.com/en-us/magazine/cc163644.aspx
It has worked for doing window development but I am not able to use it in Silverlight. The reason is because ExecutionContext is marked with the [SecurityCritical] attribute making it impossible to call from Silverlight.
Is there a similar wrapper class out there for Silverlight or is there a way I can get around this issue?
Thanks!
I would not use the class you cited even in a WinForm application. It still uses
Thread.Abortwhich can (and probably would) corrupt the app domain. Instead, use the new Cancellation mechanisms in the Task Parallel Library. You will have to rethink your whole approach to cancelling the work items though. This is because you can no longer rely on forced termination and have to use cooperative termination instead. The advantage is that the later can be guaranteed to avoid corrupting the app domain.