Re-hydrated workflow throws Profile cannot be null exception
We have a workflow as webservice application. We use custom tracking profile for each workflow type.
The worklfow assembly version got changed, so I changed the profile version too. So as the older workflows should work fine.
Now I started the workflow runtime , a workflow got triggered and persisted to DB After some time , i re-start the runtime, the workflow is re-hydrated, but try to invoke an event on workflow, it shows exception.
If The workflow engine is not re-started , everything works fine, no errors and workflow is completed.
System.Workflow.Activities.EventDeliveryFailedException: Event "Event_111" on interface type "Service.IService" for instance id "4d0b7397-4ce1-49c7-92c6-92405caa8fe4" cannot be delivered. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: profile
at System.Workflow.Runtime.RTTrackingProfile..ctor(TrackingProfile profile, Activity root, Type serviceType)
at System.Workflow.Runtime.TrackingProfileManager.CreateProfile(TrackingProfile profile, Type workflowType, Type serviceType)
at System.Workflow.Runtime.TrackingProfileManager.GetProfile(TrackingService service, Activity workflow, Version versionId)
at System.Workflow.Runtime.TrackingListenerFactory.GetChannels(Activity schedule, WorkflowExecutor exec, Guid instanceID, Type workflowType, TrackingListenerBroker& broker)
at System.Workflow.Runtime.TrackingListenerFactory.GetListener(Activity sked, WorkflowExecutor skedExec, TrackingListenerBroker broker)
at System.Workflow.Runtime.TrackingListenerFactory.GetTrackingListener(Activity sked, WorkflowExecutor skedExec, TrackingListenerBroker broker)
at System.Workflow.Runtime.TrackingListenerFactory.WorkflowExecutorInitializing(Object sender, WorkflowExecutorInitializingEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at System.Workflow.Runtime.WorkflowRuntime.WorkflowExecutorCreated(WorkflowExecutor workflowExecutor, Boolean loaded)
at System.Workflow.Runtime.WorkflowExecutor.ReRegisterWithRuntime(WorkflowRuntime workflowRuntime)
at System.Workflow.Runtime.WorkflowRuntime.RegisterExecutor(Boolean isActi开发者_StackOverflowvation, WorkflowExecutor executor)
at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)
at System.Workflow.Runtime.WorkflowRuntime.GetWorkflow(Guid instanceId)
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 RecipeChangeService.RecipeChangeService.MfgEngOrTLApproved(Guid instanceId, ResponseDataObject rdo) in E:\MES\trunk\DotNet\WorkflowDesignProject\WorkflowDesignProject\Workflow Types\RecipeChangeWF\RecipeChangeService.cs:line 64
Any ideas, what is getting wrong? There are two workflows of different versions, but attached to same profile version, can this be issue?
I found the solution for it. The version of tracking profile should match the version while creating tracking profile xml.
TrackingProfile myProfile = new TrackingProfile();
myProfile.Version = new Version("4.0.0.0");
The verison should be same as the version used in stored procedure "UpdateTrackingProfile" This solved my problem.
精彩评论