Sep 23, 2011 at 1:14 PM
Edited Sep 23, 2011 at 1:15 PM
I've been looking around on how to properly remove a WorkItem that is no longer needed. From what I've read in
this discussion, the terminate method should be used. It will do the following:
- dispose of all children, of any type
- terminate all children
- dispose of itself
- remove itself from it's parent's collection
When I use the terminate method, in debug in VS I'm not seeing any of the above happening, instead I'm seeing:
- All children remain in the Items collection, with no changes
- the workitem itself seems to have no changes at all
- the workitem is not removed from it's parents' WorkItems collection.
So naturally I'm wondering why doesn't the terminate method seem to be doing what everyone says it should be doing?
Are there any cases where terminate will completely fail to do it's job as it seems to be doing? Looking at the CAB API, it has a void return value, so I can't learn anything there. At first I thought I needed to do some manual cleanup of children to the
workitem, but after reading the thread above, it sounds like that should be handled automatically by the terminate method, which would certainly make sense. A few more questions:
In the case of a WorkItem, should I be calling dispose as well? In cases of views for example, I see dispose used regularly to clean up, but I'm not sure if it's needed for WorkItem.
In the discussion I linked to above, there was some talk about a bug preventing terminate from working properly, but the discussion is 4 years old and I'm using dlls from SCSF 2010, so I'm assuming that's not the problem.
Any thoughts/help is appreciated!
You could create a work item in the
issue tracker describing this problem so that this is considered by the product team.