EventHandlingScopeActivity/EventHandlersActivity Problem

I have a sequential workflow that has an EventHandlerScopeActivity that contains an EventHandlersActivity with four events. My local comm service interface and implementation class define a C# event for each event driven activity. While testing the event handlers, only the first event gets raised. If I remove the first event from the EventHandlersActivity then the next event handler in the collection gets raised. All other event handlers never get called when their associated events are called.

During debug, I noticed that only the first event in the EventHandlersActivity has a delegate in it's event invocation list. All other invocation lists are empty. My understanding is that WF should be setting up all of the event delegates. Does anyone have any ideas about what's happening and how to resolve this

Regards,

S2



Answer this question

EventHandlingScopeActivity/EventHandlersActivity Problem

  • h_01cs25

    S2,

    I created your scenario with an eventhandlingscope and 4 events in the eventhandlers activity by modifying the Hostcommunication sample.

    [ExternalDataExchange]

    internal interface IVotingService

    {

    event EventHandler<VotingServiceEventArgs> ApprovedProposal;
    event EventHandler<VotingServiceEventArgs> ApprovedProposal_2;
    event EventHandler<VotingServiceEventArgs> ApprovedProposal_3;
    event EventHandler<VotingServiceEventArgs> RejectedProposal;
    event EventHandler<ExternalDataEventArgs> ContinueWorkflow;
    void CreateBallot(string alias);
    void VotingDone();

    }

    My workflow looks like this

    Workflow
    CreateBallot
    EventHandlingScope

    ContinueWorkflow

    EventDriven1
    ApprovedProposal
    Code1
    EventDriven2
    ApprovedProposal_2
    Code2
    EventDriven2
    ApprovedProposal_3
    Code3
    VotingDone

    Steps in which the workflow executes is

    1. CreateBallot method is called by the workflow
    2. Host Fires events ApprovedProposal, ApprovedProposal_2 and ApprovedProposal_3. EventDriven in ApprovedProposal_3 calls method VotingDone on the host after which host fires the event ContinueWorkflow.
    3. EventHandlingScope remains active till ContinueWorkflow event arrives after which the scope completes and then the workflows completes.
    On debugging I could see that all the events have delegates associated with them.

    I did not come across the issue you have mentioned. I can send the zip file of the implementation if you want.

    I hope this scenario is similar to what you are trying to do. If not give us more details about your service and workflow

    -Sonali



  • LawrenceSQL

    S2,

    If the scope completes before firing the events, other events will not be delivered.Please ensure your eventhandlingscope is active when you are sending all the events. Are you getting any eventdeliveryfailed exceptions when you are sending other events

    Can you give us some more details about your scenario

    -Sonali



  • Tallier

    Hello Sonali,

    Thanks for the reply. The scope is active. When a fresh workflow instance is started if I look at the invocation lists for each event, only the first event in the EventHandlersActivity has a non-empty invocation list.

    There are no exceptions occurring. The entire workflow process works fine with the exception of the other events in the handlers activity not being fired due to empty invocation lists.

    -S2


  • EventHandlingScopeActivity/EventHandlersActivity Problem