Seems dispose() missed in BackgroundTaskManager<TArg, TResult>

Aug 6, 2010 at 11:19 PM
So, BackgroundTaskManager<TArg, TResult> uses Backgroundworker class. The latter is IDisposable. So, why don't you dispose Backgroundworker instance? Thanks
Coordinator
Aug 8, 2010 at 8:37 AM
Who would call Dispose() on it, and when? If its in use in ViewModel when would you call Dispose on it exactly? I'll put it on list, but cant see a sensible place to call it
Aug 9, 2010 at 1:39 PM
Hi, I see here two options: 1. Either you call backgroundWorker.Dispose() in attached backgroundWorker.RunWorkerCompleted handler; 2. Or you can make your BackgroundTaskManager<T> class IDisposable and each time BackgroundTaskManager<T>.RunBackgroundTask() is called reuse same instance of backgroundWorker. And then Dispose() method will have only one line: backgroundWorker.Dispose();
Coordinator
Aug 14, 2010 at 10:19 AM
Looking at this again, BackgroundWorker does not have Dispose() at all, its inherited from Component, but it does not have one, this is shown in both MSDN and Reflector. So its all cool as it is I think.