The Executing event of all my SetStateActivity objects dont fire

I do this when starting teh instance using

Code Block

instance.GetWorkflowDefinition()

as the root of the Activity tree.

I'm guessing that this has something to do with executioncontexts and the fact that the SetStateActivities I hook up to are only used as templates and the ones that actually run and go thru the state transaitions are just copies. However, shouldnt those copies also copy any hooked up event handlers?

Otherwise I may have to hook this up in an activity in the initialisation of each of my states, but I'd rather not have to do that as at thee moment it should work without any mods to the workflow itself.

[814 byte] By [DavidR100] at [2008-1-10]
# 1

I've noticed that the StateActivity isnt sealed, so I'm going to inherit from that and hook up the events in my custom ApprovalsStateActivity on its Execute override.

will that work or am I in for a world of pain?

DavidR100 at 2007-10-3 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

You're right. GetWorkflowDefinition returns a copy of the activity tree. Execution events will not be rased on a definition tree.

Your second option should work. The custom activity should be able to subscribe to execution events of its descendant activities.

AndreiRomanenko-MSFT at 2007-10-3 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified