Thursday, March 29, 2007 - Posts

InvokeWorkflow Activity Bug? No... Not a Bug!

Before I started writing this post, I started searching around to see if anyone else thought there might be an issue when using the InvokeWorkflow Activity. Last Saturday, I did a session on "Understanding WF Activities" and I too was having some trouble with the activity. It was not until last night when I got a chance to re-visit my demo that suddenly it hit me like a ton of bricks.

To set the stage, some of my demos are canned however I take great pleasure in coming up with demos on the fly. During a demo of the Parallel Activity, I thought it might be nice for one of the branches to invoke another workflow while the other branch just wrote to a file using a Code Activity. I had placed a Delay Activity in the workflow that was to be invoked, to show that the workflow that invoked the other workflow could finish before the invoked workflow...Did I loose you? So Workflow 1 invokes Workflow 2 within a Parallel Activity's branch. Workflow 2 has a 10 second delay to model some type of processing. Workflow 1 finishes and so I wait for Workflow 2 to finish too. And I wait…..and wait…. and wait and wait and wait!

What I didn’t notice was that I was using the Console Sequential Workflow Project, and that was my demise. Well not really…except before I had created my own custom host when playing with InvokeWorkflow Activity, so when I used the out-of-box console host, I did not realize that the runtime host was being killed, thus killing my invoked workflow. The lesson here? Make sure there is a runtime host running for invoked workflows to home to!