Last post Aug 08, 2009 03:13 AM by abaloch05
Aug 08, 2009 03:13 AM|abaloch05|LINK
I have made a state machine workflow. There are three states i.e. InitialState, State1, CompletedState.
InitialState Contains an eventDriven activity. which handles an event from Asp.net code and Changes the workflow state to State1.
The problem is when the event is raised and then I query the StateMachineWorkflowInstance CurrentState property. This property gives inconsistent results. Some times its returns null, sometimes the InitialState and sometimes State1 But the result should
I have also tried SqlTracking but the result is same inconsistency.
Here is the C# code used to raise the event.
Assembly workflowAssembly = Assembly.Load("WorkflowLibrary2");
Type workflowType = workflowAssembly.GetType("WorkflowLibrary2.Workflow1");
//CommonClass.wr is the static WorkflowRuntime Object
WorkflowInstance wfi = CommonClass.wr.CreateWorkflow(workflowType);
//This is the Service class which inherits interface [ExternalDataExchange] attribute defined
StateMachineWorkflowInstance stateMachine = new StateMachineWorkflowInstance(CommonClass.wr, wfi.InstanceId);
Label1.Text = stateMachine.CurrentStateName;
//Sometimes label1.text is "", sometimes "InitialState" and sometimes "State1".
//But the result should always be "State1" because RaiseInitiateRequest Event changes the workflow state to State1