State Machine Workflow Does not subscribe to events
Has anyone had this happen to them? Does anyone know what could be wrong?
Amanda
Has anyone had this happen to them? Does anyone know what could be wrong?
Amanda
Amanda - this usually means that the state machine workflow isn't in the state you are expecting it to be.
You can find out what state it is in by creating a StateMachineWorkflowInstance and checking the states:
StateMachineWorkflowInstance wi = new StateMachineWorkflowInstance(workflowRuntime,id);//where id is the instance id of your workflow
Console.WriteLine(wi.CurrentState);
You can also see what queues have been created (which will tell you what handleexternalevent activities are listening) by using WorkflowInstance.GetWorkflowQueueData
However, when the following code is reached
public void RaiseJobFinished(string ImageId, Guid instanceId)
{
if (JobFinished != null)
JobFinished(null, new JobEventArgs(instanceId, ImageId));
}
JobFinished (which is a public event EventHandler<JobEventArgs> JobFinished;) is null at this point however.
I cannot figure out why JobFinished is null however. The state is listening for an event of JobFinished which is declared in an interface class. The above funtion is declared in a class that implements the interface.
Amanda