Issue with Subscription and Terminated WorkItems

Topics: CAB & Smart Client Software Factory
Nov 17, 2005 at 10:55 AM
originally posted by: DLorenz

Right now, all workitems have a subscription to an event for when someone pushes Esc. It will terminate itself and show its parent. However, for some reason, this event is getting into workitems that have been Terminated. I have a List workitem. You can then edit a specific record, which creates a new, child workitem. Once you hit Esc on the edit, it Terminates itself and control goes back to List. However, when I hit Esc on the List, List will Terminate like it is supposed, but the edit workitem will get the event, even though its status is set to Terminated before handling the Esc key. The event that gets raised is using the Descendant Publication call.
Nov 19, 2005 at 6:42 AM
originally posted by: DLorenz

Alright, I found the underlying issue. I create a child workitem and terminate it. Then I create one of the same type. I'll raise an event (Esc Pressed, which Terminates the workitem), and the first workitem created will receive the event, even though it Terminated and not in it's parent's WorkItem collection. My guess is that you aren't removing subscriptions with a Terminated status in your Clean() method.
Nov 19, 2005 at 8:37 AM
originally posted by: DLorenz

Putting in GC.Collect() in OnActivated() of workitems does seem to fix this bug, but it causes some extra overhead.
Nov 19, 2005 at 11:41 AM
originally posted by: BradWilsonMSFT

Thanks for all the work tracking this down. We're evaluating our options.