Statemachine not Stable !!!!

I checked in several constellations.

Rasing Events works between 1 - 20 times than I get by random

Event can not be deliverd.

By seeing the unanswerd request here in the Forum I think it's not working.

If yes some good Ideas are always well come.

Wolfram



Answer this question

Statemachine not Stable !!!!

  • Jesse Auerbach

    Hi,

    I dunno this is helps or not, but the ONLY time I've seen this so far is when trying to raise an event handled in a state that is not the current active state (as mentioned by Andrei previously). The error message itself really didn't help me at the time.

    To help debug this stuff have you see the WorkflowMonitor example in c:\program files\microsoft sds\windows workflow foundation\samples.zip . If not, extract and build this solution and copy the wfmon.exe to your bin directory and run it from there. It should pick up any information about persisted workflows which you can visually review. Be sure to set the SqlPersistence connection settings under the Monitor / Settings menu.

    Also, if not using the SqlTrackingService, try adding that with the default tracking profile to see a log of what's going on in your workflow lifecycle. It may help as well.

    I hope this helps!


    Shawn



  • BorisVG

    If you want to raise your events based on status transitions, try waiting for "Entering" rather than "Started".

    There is a posable race condition with started because the State could still be executing it's initializer.



  • paschalia

    Thank you

    but how to see if it is entering or it is started

    for that I need a hint.

    regards

    Wolfram


  • Spoofed

    Thanks a lot for the details!

    There is one more piece of information I need. Could you please give me full exception information, including a stack trace and inner exceptions Inner exception normally contains most inportant details in case of raise event failures. I'll try to setup a repro case on my machine.



  • Jonny_B

    The StateMachineWorkflowInstance helper class can be used to figure out the current state.

    StateMachineWorkflowInstance stateMachineInstance = new StateMachineWorkflowInstance(workflowRuntime, instance.InstanceId);

    Console.WriteLine(stateMachineInstance.CurrentStateName);

    Hope this helps.



  • uwel

    sure Andrei here it comes:

    "System.Workflow.Activities.EventDeliveryFailedException: Event "ArbeitnehmerKommt" on interface type "Flow.bsone.bde.IKommtGeht" for instance id "c84f4555-286b-42d4-a82c-b6c280390022" cannot be delivered. ---> System.InvalidOperationException: Queue 'Message Properties

    Interface Type:Flow.bsone.bde.IKommtGeht

    Method Name:ArbeitnehmerKommt

    CorrelationValues:

    ' is not enabled.

    at System.Workflow.Runtime.WorkflowQueuingService.EnqueueEvent(IComparable queueName, Object item)

    at System.Workflow.Runtime.WorkflowExecutor.EnqueueItemOnIdle(IComparable queueName, Object item, IPendingWork pendingWork, Object workItem)

    at System.Workflow.Runtime.WorkflowInstance.EnqueueItemOnIdle(IComparable queueName, Object item, IPendingWork pendingWork, Object workItem)

    at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)

    --- End of inner exception stack trace ---

    at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)

    at Flow.bsone.bde.KommtGeht.Kommt(Object evt) in F:\bsone.net\Flow.bsone.bde\IKommtGeht.vb:line 74"


  • JR_runnfool

    thanks Adrei,

    waitForIdle = True I set before was not giving me any reliefe.

    how can I check out if the state is active , I thought the workflow will enqueue for me !
    thanks for answer

    Wolfram


  • ARMYVET

    Thanks for reply

    I took that idea exact from that sample!!!

    I have 6 States

    I checked that I have initial State and Finalize State! I have created a Interface which will provide 6 different events

    I checked that per state each event is used distinct. I have placed as average around 4 Eventdriven activities. per Eventdriven Activity I use External Eventhandler and here I attacht my Interface including the Event defined in the Interface as well I checked that the serializable attribute is there for ArgumentHandler.

    All States are based on External Eventhandlers correct!

    As well checked out with the latest Sample CuttingEdge so reused the code and idea's from both of them

    ONLY Difference is I use SqlPersistentService

    When I swith that off it works 100 % fast and nice I switch on problem as described

    Thanks

    Wolfram


  • Pete Siedle

    OK as far I understood you and that method I must check what activity is in the moment in my scope.

    but that will not work for Statemachine, I want to use the statemachine this way that I have a lot of EventHandlers which are waiting inside of my State for some Raiseevnet.

    based on the raised event it should than run than some squence of activities.

    But it seems that is not working.

    I would like to check is the workflow is ready to receive some message why not ! but here my knowledge ends I do not know how to controll the timing or how to check for that.

    Help still is badly needed


  • CSC

    Thanks for reply

    yes I'm using this and I check

    button1.enable = smwi.PossibleStateTransitions.Contains("EmployeeStateInitialState")

    ..... some more of those

    based on that I'm enabling my Buttons

    But reality is, when I raise the event first time without response second time I get an error message

    can not delivery message ....

    I do not know how check if a activity is ready to receive a message

    thanks

    Wolfram


  • Mr.Mel

    Most probably the raise event happens before the state is active. Please see this post for more details http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=271267&SiteID=1

  • topm

    The OrderingStateMachine sample does similar checks in it's EnableButtons method in Form1.cs. This method checks all the current queues available on the instance, to see which events can be raised.

    If queue exists, and raise event still fails, please share some more details about the workflow structure. How many states, and event drivens are there Are all of them based on HandleExternalEvent



  • MKyE

    Are you using EnqueueItemOnIdle to submit the messages

  • sherrill

    first of thanks to all answering me and trying to help.

    Ok I'm not using EnqueueItemOnIdle. I'm only raising Events. As given e.g. in the OrdersStatemachine Sample.

    So I'm checking for existing transitons based on that I'm raisng an event.

    What I have seen that the Workflow is Aborting or say at least it's sendinig that event.

    I will read about that method and I will try to use it.

    thanks

    Wolfram


  • Statemachine not Stable !!!!