Discussion WF hangs when incorrect state transition

  • Sunday, July 22, 2012 10:30 PM
     
     

    Hi All,

    I have a state machine 4.5 WF (WCf WF Service Application) that has several states. It has few operation contracts exposed as receive activities. If these operation contracts gets called in a proper flow, WF behaves as expected. For example, CreateOrder, ModifyOrder,Check, Confirm, Complete.

    However, if client calls CreateOrder and then straight away Confirm (missing states Modify,Check) state machine WF hangs. 

    What could be the issue?

    Thanking you in anticipation.

All Replies

  • Tuesday, July 24, 2012 1:14 AM
    Moderator
     
     

    I think I can help dispel confusion. First imagine that

    1) State Machine workflow can only be in one state at a given time.
    2) suppose that state has only certain outgoing transitions, A, B, and C.

    The state machine will always appear to be 'hanging' until one of those transition's events happens. If event D happens (where D is a transition from some other state that we are not in right now), the state machine will have no way of understanding or reacting to that event, so it will continue to wait for events A, B, or C.

    In case you want event D to result in an error when called out of order, you could do it by explicitly modelling an error state in your workflow, and having unexpected events route to that state.
    Tim

  • Thursday, July 26, 2012 1:30 PM
     
     

    Hi Tim,<o:p></o:p>

    Thank you for your response. It cleared the confusion rather confirmed my understanding of state machines.<o:p></o:p>

    Regarding your last point, is a general practise to raise errors for incorrect transitions? Do you have any example of “Error State” and routing mechanism.<o:p></o:p>

    Thanking you in anticipation.<o:p></o:p>

    Kind Regards,<o:p></o:p>

    Rahul.<o:p></o:p>

  • Thursday, July 26, 2012 2:16 PM
     
     

    Just a general query, if I am correlating all receive activities, why can't my WF understand its current state and next state/states and raise an error if called out of order. This was my understanding.

    ta, R.

  • Sunday, July 29, 2012 12:44 AM
    Moderator
     
     

    Hi Rahul,

    Thanks for posting! This issue has been logged, product team is currently investigating further. If you want to track this issue, you can sumbit a post at connect site.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.