Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading previous version workflows with new version assembly

I am trying to figure out a way to upgrade assemblies used by our worklow runtime (custom activities) while still being able to load (deserialize) old instances. My situation is like this:

  1. have a workflow instance created and persisted with CustomActivities v.1.0.0.0
  2. deploy a new version of the product witch has CustomActivities v.2.0.0.0
  3. try to load previous workflows in the new runtime

The difference between v.1 and v.2 is that we have some extra classes in the assembly. The structure for the existing types has not changed so i would presume that binary deserialization would still work. We are redirecting all types from v.1 to v.2 using AssemblyResolve event

if (args.Name.Contains("CustomActivities"))
{
    Type someTypeFromCustomActivities = typeof(WorkflowType);
    return someTypeFromCustomActivities.Assembly;
}

Yet at some point during the deserialization process we are getting the following exception:

SerializationException: The object with ID 153 implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other.

What might cause this behavior and how can we work around it? Also if anyone has a strategy for upgrading workflows that does not involve running side by side assemblies (old and new versions in the same app domain) they would be welcomed.

like image 353
Adrian Zanescu Avatar asked Apr 05 '12 09:04

Adrian Zanescu


1 Answers

The assembly resolve event does nothing for changing the serialized types assembly references. Have you tried an assembly binding redirect at the machine level from v1 to v2.

Update: I did find this link that talks about using a binding redirect to forward old workflows to new versions using an appliesTo attribute.

http://msdn.microsoft.com/en-us/library/aa349375.aspx

like image 143
Steve Mitcham Avatar answered Oct 21 '22 03:10

Steve Mitcham