Updating Workflow Defintions
- Hi,
I'm currently fiddling around with my workflows and I noticed the following:
I create a first version of my workflow-definition, test the workflow and the decide everything works fine so far. So I go back and add some more "features" to my workflow-definition. So I re-compile everything and copy it to my dev-server.
When I want to resume some existing workflows I get some errors like:
--- cut --- cut --- cut ---
System.Workflow.Activities.EventDeliveryFailedException: Das Ereignis "ReviewAssigned" von Schnittstellentyp "WorkflowDms.Workflow.LocalService.IReviewStatusService" für die Instanz-ID "266ffb6b-f68f-476f-8a85-405343ec78f3" kann nicht übermittelt werden. ---> System.Runtime.Serialization.SerializationException: Das Objekt mit der ID 40 implementiert die IObjectReference-Schnittstelle, für die nicht alle Abhängigkeiten aufgelöst werden können. Mögliche Ursache sind zwei Instanzen von IObjectReference, die voneinander abhängig sind.
bei System.Runtime.Serialization.ObjectManager.GetCompletionInfo(FixupHolder fixup, ObjectHolder& holder, Object& member, Boolean bThrowIfMissing)
bei System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)
bei System.Runtime.Serialization.ObjectManager.DoFixups()
bei System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
bei System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)
bei System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity)
bei System.Workflow.Runtime.Hosting.WorkflowPersistenceService.RestoreFromDefaultSerializedForm(Byte[] activityBytes, Activity outerActivity)
bei System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService.LoadWorkflowInstanceState(Guid id)
bei System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)
bei System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)
bei System.Workflow.Runtime.WorkflowRuntime.GetWorkflow(Guid instanceId)
bei System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)
bei WorkflowDms.Workflow.LocalService.ReviewStatusService.RaiseReviewAssigned(Guid workflowId, String editorAccount) in e:\Projekte\WorkflowDms\src\Workflow\LocalService\ReviewStatusService.cs:Zeile 62.
--- cut --- cut --- cut ---
I figured that this is because of my new workflow-definition. Well, how am I supposed to handle this? I would like to be able to switch my workflow-definition to a new version even for already existing workflows. Basically not a whole lot changed, my workflow still has the same states (it's a state-machine workflow) and has the same external-data-exchange definition. What did change were the activities of the events, and I did add some event-driven-activities, that would be triggered on the entry of certain states.
Answers
To make changes to existing workflow instances, you have to go through "dynamic update". The dynamic update feature in WF allows you to programmatically update the definition of a running instance. To learn more about how to use dynamic update, see this article by Mark Schmidt.
http://blogs.msdn.com/markhsch/archive/2005/09/23/473373.aspx
There is no way to simply change the definition, redeploy the dll and have the workflow runtime pick up the new definition for a running instance.
Shelly
All Replies
Hi.
From what I have understood by reading articles and posts in this forum you cannot update the workflow definition of running workflow instances.
The solution seems to be to have the old workflow definition in place until all already started workflow instances are finished.
New workflow instances will be using the new definition.
- Yeah, I (kinda) figured the same (the hard way). But how can I wait for all running instances to finish? I have a user-driven workflow, so I would need to avoid creating new workflows in my app, and wait until all existing workflows are being "completed". And this could take some time (as I said, it's user-driven ... ).
I read about the ability to have multiple defintions of workflows side-by-side ... but this seems not to be so easy. The assembly containing the workflow-defintion also contains some other stuff (like custom actions, like some "helper class" to send emails ...).
I tried adding the assemblies to the GAC, but the helper-classes are instantiated via Castle Windsor
and Windsor doesn't seem to find the assembly in the GAC ... To make changes to existing workflow instances, you have to go through "dynamic update". The dynamic update feature in WF allows you to programmatically update the definition of a running instance. To learn more about how to use dynamic update, see this article by Mark Schmidt.
http://blogs.msdn.com/markhsch/archive/2005/09/23/473373.aspx
There is no way to simply change the definition, redeploy the dll and have the workflow runtime pick up the new definition for a running instance.
Shelly
Shelly Guo - MSFT wrote: There is no way to simply change the definition, redeploy the dll and have the workflow runtime pick up the new definition for a running instance.
That's a shame!!

