Reputation: 8008
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:
CustomActivities
v.1.0.0.0CustomActivities
v.2.0.0.0The 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.
Upvotes: 10
Views: 1048
Reputation: 5313
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
Upvotes: 2