The Problem SolverWIndows Workflow Foundation
HomeShow ChangesEditPrintRecent ChangesSubscriptionsLost and FoundFind ReferencesRename

Search

History

26-11-2007 08:14:565-10-2007 11:21:3219-10-2006 12:37:0419-10-2006 12:36:1319-10-2006 12:06:26

List all versions

Conditioned Activity Group
.
Summary

As a small test I created a small workflow containing a ConditionedActivityGroup activity with three CodeActivities as childs and an UntilCondition. The conditions are pretty simple:

  1. I have a counter initialized to -2,
  2. The until terminates the CAG when the counter reaches 5 and increments it.
  3. Code activity 1 runs while the counter is less than or equal to 1
  4. Code activity 2 runs while the counter is less than or equal to 2
  5. Code activity 3 runs while the counter is less than or equal to 3

So according to the docs at http://windowssdk.msdn.microsoft.com/en-us/library/ms733611.aspx the Until is executed, then all Whens and the first activity, the until, the next when etc….

This actually results in the following trace:

Testing CAG Until - Counter = -2
Testing Condition 1 - Counter = -1
Testing Condition 2 - Counter = -1
Testing Condition 3 - Counter = -1
Code in condition 1 - Counter = -1
Code in condition 2 - Counter = -1
Code in condition 3 - Counter = -1
Testing CAG Until - Counter = -1
Testing Condition 1 - Counter = 0
Testing CAG Until - Counter = 0
Testing Condition 2 - Counter = 1
Testing CAG Until - Counter = 1
Testing Condition 3 - Counter = 2
Code in condition 1 - Counter = 2
Code in condition 2 - Counter = 2
Code in condition 3 - Counter = 2
Testing CAG Until - Counter = 2
Testing Condition 1 - Counter = 3
Testing CAG Until - Counter = 3
Testing Condition 1 - Counter = 4
Testing Condition 2 - Counter = 4
Testing CAG Until - Counter = 4
Testing Condition 1 - Counter = 5
Testing Condition 2 - Counter = 5
Testing Condition 3 - Counter = 5

Not at all what I expected and although I believe its in spirit with the docs its certainly confusing. The first time round all When conditions are executed followed by all activities, basically the whole batch is tested and run. And the subsequent loops each activity is separately tested, including the CAG itself, and executed.

So the verdict is?

Well the sequence of activities and checks is very hard to predict beforehand without thinking very carefully about this behavior and remembering that the first iterations is very different from the subsequent ones.

I think this behavior, specially the difference between the first and subsequent iterations, sucks big time

Wiki Usage

This wiki site is supposed to be a shared resource. As a shared resource everyone is encouraged to add new content or modify existing content!

Enjoy the WF wiki.

Recent Topics