public virtual void OnParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) { ExecutionEntity scopeExecution = migratingInstance.ResolveRepresentativeExecution(); IList <IActivityExecution> concurrentInActiveExecutions = scopeExecution.FindInactiveChildExecutions(GetInnerActivity((ActivityImpl)migratingInstance.SourceScope)); //variables on ended inner instance executions need not be migrated anywhere //since they are also not represented in the tree of migrating instances, we remove // them from the parse context here to avoid a validation exception foreach (IActivityExecution execution in concurrentInActiveExecutions) { foreach (VariableInstanceEntity variable in ((ExecutionEntity)execution).VariablesInternal) { parseContext.Consume(variable); } } }