public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            System.Workflow.Activities.Common.WalkerEventHandler handler = null;
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);
            InvokeWorkflowActivity    activity         = obj as InvokeWorkflowActivity;

            if (activity == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(InvokeWorkflowActivity).FullName }), "obj");
            }
            if (activity.TargetWorkflow == null)
            {
                ValidationError error = new ValidationError(SR.GetString("Error_TypePropertyInvalid", new object[] { "TargetWorkflow" }), 0x116)
                {
                    PropertyName = "TargetWorkflow"
                };
                validationErrors.Add(error);
                return(validationErrors);
            }
            ITypeProvider service = (ITypeProvider)manager.GetService(typeof(ITypeProvider));

            if (service == null)
            {
                throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
            }
            Type targetWorkflow = activity.TargetWorkflow;

            if ((targetWorkflow.Assembly == null) && (service.LocalAssembly != null))
            {
                Type type = service.LocalAssembly.GetType(targetWorkflow.FullName);
                if (type != null)
                {
                    targetWorkflow = type;
                }
            }
            if (!TypeProvider.IsAssignable(typeof(Activity), targetWorkflow))
            {
                ValidationError error2 = new ValidationError(SR.GetString("Error_TypeIsNotRootActivity", new object[] { "TargetWorkflow" }), 0x60e)
                {
                    PropertyName = "TargetWorkflow"
                };
                validationErrors.Add(error2);
                return(validationErrors);
            }
            Activity seedActivity = null;

            try
            {
                seedActivity = Activator.CreateInstance(targetWorkflow) as Activity;
            }
            catch (Exception)
            {
            }
            if (seedActivity == null)
            {
                ValidationError error3 = new ValidationError(SR.GetString("Error_GetCalleeWorkflow", new object[] { activity.TargetWorkflow }), 0x500)
                {
                    PropertyName = "TargetWorkflow"
                };
                validationErrors.Add(error3);
                return(validationErrors);
            }
            System.Workflow.Activities.Common.Walker walker = new System.Workflow.Activities.Common.Walker();
            if (handler == null)
            {
                handler = delegate(System.Workflow.Activities.Common.Walker w, System.Workflow.Activities.Common.WalkerEventArgs args) {
                    if ((args.CurrentActivity is WebServiceInputActivity) && ((WebServiceInputActivity)args.CurrentActivity).IsActivating)
                    {
                        ValidationError item = new ValidationError(SR.GetString("Error_ExecWithActivationReceive"), 0x614)
                        {
                            PropertyName = "Name"
                        };
                        validationErrors.Add(item);
                        args.Action = System.Workflow.Activities.Common.WalkerAction.Abort;
                    }
                };
            }
            walker.FoundActivity += handler;
            walker.Walk(seedActivity);
            bool flag = false;

            for (Activity activity3 = activity.Parent; activity3 != null; activity3 = activity3.Parent)
            {
                if ((activity3 is CompensatableTransactionScopeActivity) || (activity3 is TransactionScopeActivity))
                {
                    flag = true;
                    break;
                }
            }
            if (flag)
            {
                ValidationError error4 = new ValidationError(SR.GetString("Error_ExecInAtomicScope"), 0x502);
                validationErrors.Add(error4);
            }
            foreach (WorkflowParameterBinding binding in activity.ParameterBindings)
            {
                PropertyInfo property = null;
                property = targetWorkflow.GetProperty(binding.ParameterName);
                if (property == null)
                {
                    ValidationError error5 = new ValidationError(SR.GetString("Error_ParameterNotFound", new object[] { binding.ParameterName }), 0x504);
                    if (InvokeWorkflowActivity.ReservedParameterNames.Contains(binding.ParameterName))
                    {
                        error5.PropertyName = ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(activity.GetType(), binding.ParameterName);
                    }
                    validationErrors.Add(error5);
                }
                else
                {
                    Type propertyType = property.PropertyType;
                    if (binding.GetBinding(WorkflowParameterBinding.ValueProperty) != null)
                    {
                        ValidationErrorCollection errors = System.Workflow.Activities.Common.ValidationHelpers.ValidateProperty(manager, activity, binding.GetBinding(WorkflowParameterBinding.ValueProperty), new PropertyValidationContext(binding, null, binding.ParameterName), new BindValidationContext(propertyType, AccessTypes.Read));
                        if (errors.Count != 0)
                        {
                            validationErrors.AddRange(errors);
                        }
                    }
                }
            }
            return(validationErrors);
        }
 internal static ValidationErrorCollection Validate(ValidationManager manager, object obj)
 {
     object[] attributes;
     CorrelationToken correlator;
     string qualifiedCorrelationToken;
     Activity sourceActivity;
     ValidationErrorCollection errors = new ValidationErrorCollection();
     Activity activity = obj as Activity;
     if (!(activity is CallExternalMethodActivity) && !(activity is HandleExternalEventActivity))
     {
         throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(Activity).FullName }), "obj");
     }
     Type interfaceType = (activity is CallExternalMethodActivity) ? ((CallExternalMethodActivity) activity).InterfaceType : ((HandleExternalEventActivity) activity).InterfaceType;
     if (interfaceType != null)
     {
         if (interfaceType.ContainsGenericParameters)
         {
             ValidationError item = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_GenericMethodsNotSupported"), new object[] { interfaceType.FullName }), 0x155) {
                 PropertyName = "InterfaceType"
             };
             errors.Add(item);
             return errors;
         }
         attributes = interfaceType.GetCustomAttributes(typeof(ExternalDataExchangeAttribute), false);
         if (attributes.Length == 0)
         {
             ValidationError error2 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_ExternalDataExchangeException"), new object[] { interfaceType.FullName }), 0x113) {
                 PropertyName = "InterfaceType"
             };
             errors.Add(error2);
             return errors;
         }
         if (activity.Site == null)
         {
             ValidationErrorCollection errors2 = ValidateHostInterface(manager, interfaceType, activity);
             if (errors2.Count != 0)
             {
                 errors.AddRange(errors2);
                 return errors;
             }
         }
         MemberInfo info = null;
         if (activity is CallExternalMethodActivity)
         {
             if ((((CallExternalMethodActivity) activity).MethodName == null) || (((CallExternalMethodActivity) activity).MethodName.Length == 0))
             {
                 return errors;
             }
             MethodInfo info2 = interfaceType.GetMethod(((CallExternalMethodActivity) activity).MethodName, BindingFlags.Public | BindingFlags.Instance);
             if ((info2 == null) || info2.IsSpecialName)
             {
                 errors.Add(new ValidationError(SR.GetString("Error_MissingMethodName", new object[] { activity.Name, ((CallExternalMethodActivity) activity).MethodName }), 0x528));
                 return errors;
             }
             if (info2.ContainsGenericParameters)
             {
                 ValidationError error3 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_GenericMethodsNotSupported"), new object[] { info2.Name }), 0x155) {
                     PropertyName = "MethodName"
                 };
                 errors.Add(error3);
                 return errors;
             }
             info = info2;
         }
         else
         {
             if ((((HandleExternalEventActivity) activity).EventName == null) || (((HandleExternalEventActivity) activity).EventName.Length == 0))
             {
                 return errors;
             }
             EventInfo info3 = interfaceType.GetEvent(((HandleExternalEventActivity) activity).EventName, BindingFlags.Public | BindingFlags.Instance);
             if (info3 == null)
             {
                 errors.Add(new ValidationError(SR.GetString("Error_MissingEventName", new object[] { activity.Name, ((HandleExternalEventActivity) activity).EventName }), 0x528));
                 return errors;
             }
             info = info3;
         }
         attributes = interfaceType.GetCustomAttributes(typeof(CorrelationProviderAttribute), false);
         if (attributes.Length == 0)
         {
             correlator = activity.GetValue((activity is CallExternalMethodActivity) ? CallExternalMethodActivity.CorrelationTokenProperty : HandleExternalEventActivity.CorrelationTokenProperty) as CorrelationToken;
             if (interfaceType.GetCustomAttributes(typeof(CorrelationParameterAttribute), false).Length == 0)
             {
                 if (correlator != null)
                 {
                     errors.Add(new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_CorrelationTokenSpecifiedForUncorrelatedInterface"), new object[] { activity.QualifiedName, interfaceType }), 0x119, false, "CorrelationToken"));
                 }
                 return errors;
             }
             if (activity.Parent == null)
             {
                 return errors;
             }
             if ((correlator == null) || string.IsNullOrEmpty(correlator.Name))
             {
                 errors.Add(new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_MissingCorrelationTokenProperty"), new object[] { activity.QualifiedName }), 0x109, false, "CorrelationToken"));
                 return errors;
             }
             if (string.IsNullOrEmpty(correlator.OwnerActivityName))
             {
                 errors.Add(new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_MissingCorrelationTokenOwnerNameProperty"), new object[] { activity.QualifiedName }), 0x109, false, "CorrelationToken"));
                 return errors;
             }
             qualifiedCorrelationToken = null;
             sourceActivity = activity.GetActivityByName(correlator.OwnerActivityName);
             if (sourceActivity == null)
             {
                 sourceActivity = Helpers.ParseActivityForBind(activity, correlator.OwnerActivityName);
             }
             if (sourceActivity != null)
             {
                 qualifiedCorrelationToken = sourceActivity.QualifiedName;
             }
             Activity seedActivity = null;
             CompositeActivity parent = activity.Parent;
             Activity activity3 = parent;
             bool flag = false;
             while (parent != null)
             {
                 if ((parent is ReplicatorActivity) && (seedActivity == null))
                 {
                     seedActivity = parent;
                 }
                 if (qualifiedCorrelationToken == parent.QualifiedName)
                 {
                     flag = true;
                 }
                 activity3 = parent;
                 parent = parent.Parent;
             }
             if (!flag)
             {
                 ValidationError error4 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_OwnerActivityIsNotParent"), new object[] { activity.QualifiedName }), 0x109) {
                     PropertyName = "CorrelationToken"
                 };
                 errors.Add(error4);
             }
             bool flag2 = false;
             attributes = info.GetCustomAttributes(typeof(CorrelationInitializerAttribute), false);
             if (attributes.Length > 0)
             {
                 flag2 = true;
             }
             if ((flag2 && (seedActivity != null)) && (activity is HandleExternalEventActivity))
             {
                 ValidationError error5 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_InitializerInReplicator"), new object[] { seedActivity.QualifiedName }), 0x62d, false) {
                     PropertyName = "CorrelationToken"
                 };
                 errors.Add(error5);
             }
             if (string.IsNullOrEmpty(qualifiedCorrelationToken))
             {
                 return errors;
             }
             if (seedActivity != null)
             {
                 bool isValid = false;
                 System.Workflow.Activities.Common.Walker walker = new System.Workflow.Activities.Common.Walker();
                 walker.FoundActivity += delegate (System.Workflow.Activities.Common.Walker w, System.Workflow.Activities.Common.WalkerEventArgs args) {
                     if (args.CurrentActivity.Enabled && (args.CurrentActivity.QualifiedName == qualifiedCorrelationToken))
                     {
                         isValid = true;
                         args.Action = System.Workflow.Activities.Common.WalkerAction.Abort;
                     }
                 };
                 walker.Walk(seedActivity);
                 if (!isValid)
                 {
                     ValidationError error6 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_CorrelationTokenInReplicator", new object[] { correlator.Name, seedActivity.QualifiedName }), new object[0]), 0x618, true) {
                         PropertyName = "CorrelationToken"
                     };
                     errors.Add(error6);
                 }
             }
             if (flag2)
             {
                 return errors;
             }
             bool isValid = false;
             bool ownerNameValidated = false;
             bool initFollowerInTxnlScope = false;
             System.Workflow.Activities.Common.Walker walker2 = new System.Workflow.Activities.Common.Walker();
             walker2.FoundActivity += delegate (System.Workflow.Activities.Common.Walker w, System.Workflow.Activities.Common.WalkerEventArgs args) {
                 Activity currentActivity = args.CurrentActivity;
                 if (currentActivity.Enabled && ((currentActivity is CallExternalMethodActivity) || (currentActivity is HandleExternalEventActivity)))
                 {
                     CorrelationToken token = currentActivity.GetValue((currentActivity is CallExternalMethodActivity) ? CallExternalMethodActivity.CorrelationTokenProperty : HandleExternalEventActivity.CorrelationTokenProperty) as CorrelationToken;
                     if (((token != null) && (!(currentActivity is CallExternalMethodActivity) || interfaceType.Equals(((CallExternalMethodActivity) currentActivity).InterfaceType))) && (!(currentActivity is HandleExternalEventActivity) || interfaceType.Equals(((HandleExternalEventActivity) currentActivity).InterfaceType)))
                     {
                         MemberInfo info = null;
                         if (currentActivity is CallExternalMethodActivity)
                         {
                             if ((((CallExternalMethodActivity) currentActivity).MethodName == null) || (((CallExternalMethodActivity) currentActivity).MethodName.Length == 0))
                             {
                                 return;
                             }
                             MethodInfo method = interfaceType.GetMethod(((CallExternalMethodActivity) currentActivity).MethodName, BindingFlags.Public | BindingFlags.Instance);
                             if ((method == null) || method.IsSpecialName)
                             {
                                 return;
                             }
                             info = method;
                         }
                         else
                         {
                             if ((((HandleExternalEventActivity) currentActivity).EventName == null) || (((HandleExternalEventActivity) currentActivity).EventName.Length == 0))
                             {
                                 return;
                             }
                             EventInfo info3 = interfaceType.GetEvent(((HandleExternalEventActivity) currentActivity).EventName, BindingFlags.Public | BindingFlags.Instance);
                             if (info3 == null)
                             {
                                 return;
                             }
                             info = info3;
                         }
                         attributes = info.GetCustomAttributes(typeof(CorrelationInitializerAttribute), false);
                         if (attributes.Length != 0)
                         {
                             if (activity is HandleExternalEventActivity)
                             {
                                 Activity transactionalScopeParent = GetTransactionalScopeParent(currentActivity);
                                 if ((transactionalScopeParent != null) && IsFollowerInTxnlScope(transactionalScopeParent, activity))
                                 {
                                     initFollowerInTxnlScope = true;
                                 }
                             }
                             sourceActivity = activity.GetActivityByName(token.OwnerActivityName);
                             if (sourceActivity == null)
                             {
                                 sourceActivity = Helpers.ParseActivityForBind(activity, token.OwnerActivityName);
                             }
                             if (sourceActivity != null)
                             {
                                 string qualifiedName = sourceActivity.QualifiedName;
                             }
                             if ((correlator.Name == token.Name) && IsOwnerActivitySame(correlator.OwnerActivityName, token.OwnerActivityName, activity, currentActivity))
                             {
                                 isValid = true;
                                 ownerNameValidated = true;
                                 args.Action = System.Workflow.Activities.Common.WalkerAction.Abort;
                             }
                         }
                     }
                 }
             };
             walker2.Walk(activity3);
             if (!isValid)
             {
                 ValidationError error7 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_UninitializedCorrelation"), new object[0]), 0x538, true) {
                     PropertyName = "CorrelationToken"
                 };
                 errors.Add(error7);
                 if (ownerNameValidated)
                 {
                     error7 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_MisMatchCorrelationTokenOwnerNameProperty"), new object[] { correlator.Name }), 0x538, false) {
                         PropertyName = "CorrelationToken"
                     };
                     errors.Add(error7);
                 }
             }
             if (initFollowerInTxnlScope)
             {
                 ValidationError error8 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_InitializerFollowerInTxnlScope"), new object[0]), 0x62e, false) {
                     PropertyName = "CorrelationToken"
                 };
                 errors.Add(error8);
             }
         }
     }
     return errors;
 }
        internal static ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            object[]                  attributes;
            CorrelationToken          correlator;
            string                    qualifiedCorrelationToken;
            Activity                  sourceActivity;
            ValidationErrorCollection errors   = new ValidationErrorCollection();
            Activity                  activity = obj as Activity;

            if (!(activity is CallExternalMethodActivity) && !(activity is HandleExternalEventActivity))
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(Activity).FullName }), "obj");
            }
            Type interfaceType = (activity is CallExternalMethodActivity) ? ((CallExternalMethodActivity)activity).InterfaceType : ((HandleExternalEventActivity)activity).InterfaceType;

            if (interfaceType != null)
            {
                if (interfaceType.ContainsGenericParameters)
                {
                    ValidationError item = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_GenericMethodsNotSupported"), new object[] { interfaceType.FullName }), 0x155)
                    {
                        PropertyName = "InterfaceType"
                    };
                    errors.Add(item);
                    return(errors);
                }
                attributes = interfaceType.GetCustomAttributes(typeof(ExternalDataExchangeAttribute), false);
                if (attributes.Length == 0)
                {
                    ValidationError error2 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_ExternalDataExchangeException"), new object[] { interfaceType.FullName }), 0x113)
                    {
                        PropertyName = "InterfaceType"
                    };
                    errors.Add(error2);
                    return(errors);
                }
                if (activity.Site == null)
                {
                    ValidationErrorCollection errors2 = ValidateHostInterface(manager, interfaceType, activity);
                    if (errors2.Count != 0)
                    {
                        errors.AddRange(errors2);
                        return(errors);
                    }
                }
                MemberInfo info = null;
                if (activity is CallExternalMethodActivity)
                {
                    if ((((CallExternalMethodActivity)activity).MethodName == null) || (((CallExternalMethodActivity)activity).MethodName.Length == 0))
                    {
                        return(errors);
                    }
                    MethodInfo info2 = interfaceType.GetMethod(((CallExternalMethodActivity)activity).MethodName, BindingFlags.Public | BindingFlags.Instance);
                    if ((info2 == null) || info2.IsSpecialName)
                    {
                        errors.Add(new ValidationError(SR.GetString("Error_MissingMethodName", new object[] { activity.Name, ((CallExternalMethodActivity)activity).MethodName }), 0x528));
                        return(errors);
                    }
                    if (info2.ContainsGenericParameters)
                    {
                        ValidationError error3 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_GenericMethodsNotSupported"), new object[] { info2.Name }), 0x155)
                        {
                            PropertyName = "MethodName"
                        };
                        errors.Add(error3);
                        return(errors);
                    }
                    info = info2;
                }
                else
                {
                    if ((((HandleExternalEventActivity)activity).EventName == null) || (((HandleExternalEventActivity)activity).EventName.Length == 0))
                    {
                        return(errors);
                    }
                    EventInfo info3 = interfaceType.GetEvent(((HandleExternalEventActivity)activity).EventName, BindingFlags.Public | BindingFlags.Instance);
                    if (info3 == null)
                    {
                        errors.Add(new ValidationError(SR.GetString("Error_MissingEventName", new object[] { activity.Name, ((HandleExternalEventActivity)activity).EventName }), 0x528));
                        return(errors);
                    }
                    info = info3;
                }
                attributes = interfaceType.GetCustomAttributes(typeof(CorrelationProviderAttribute), false);
                if (attributes.Length == 0)
                {
                    correlator = activity.GetValue((activity is CallExternalMethodActivity) ? CallExternalMethodActivity.CorrelationTokenProperty : HandleExternalEventActivity.CorrelationTokenProperty) as CorrelationToken;
                    if (interfaceType.GetCustomAttributes(typeof(CorrelationParameterAttribute), false).Length == 0)
                    {
                        if (correlator != null)
                        {
                            errors.Add(new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_CorrelationTokenSpecifiedForUncorrelatedInterface"), new object[] { activity.QualifiedName, interfaceType }), 0x119, false, "CorrelationToken"));
                        }
                        return(errors);
                    }
                    if (activity.Parent == null)
                    {
                        return(errors);
                    }
                    if ((correlator == null) || string.IsNullOrEmpty(correlator.Name))
                    {
                        errors.Add(new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_MissingCorrelationTokenProperty"), new object[] { activity.QualifiedName }), 0x109, false, "CorrelationToken"));
                        return(errors);
                    }
                    if (string.IsNullOrEmpty(correlator.OwnerActivityName))
                    {
                        errors.Add(new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_MissingCorrelationTokenOwnerNameProperty"), new object[] { activity.QualifiedName }), 0x109, false, "CorrelationToken"));
                        return(errors);
                    }
                    qualifiedCorrelationToken = null;
                    sourceActivity            = activity.GetActivityByName(correlator.OwnerActivityName);
                    if (sourceActivity == null)
                    {
                        sourceActivity = Helpers.ParseActivityForBind(activity, correlator.OwnerActivityName);
                    }
                    if (sourceActivity != null)
                    {
                        qualifiedCorrelationToken = sourceActivity.QualifiedName;
                    }
                    Activity          seedActivity = null;
                    CompositeActivity parent       = activity.Parent;
                    Activity          activity3    = parent;
                    bool flag = false;
                    while (parent != null)
                    {
                        if ((parent is ReplicatorActivity) && (seedActivity == null))
                        {
                            seedActivity = parent;
                        }
                        if (qualifiedCorrelationToken == parent.QualifiedName)
                        {
                            flag = true;
                        }
                        activity3 = parent;
                        parent    = parent.Parent;
                    }
                    if (!flag)
                    {
                        ValidationError error4 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_OwnerActivityIsNotParent"), new object[] { activity.QualifiedName }), 0x109)
                        {
                            PropertyName = "CorrelationToken"
                        };
                        errors.Add(error4);
                    }
                    bool flag2 = false;
                    attributes = info.GetCustomAttributes(typeof(CorrelationInitializerAttribute), false);
                    if (attributes.Length > 0)
                    {
                        flag2 = true;
                    }
                    if ((flag2 && (seedActivity != null)) && (activity is HandleExternalEventActivity))
                    {
                        ValidationError error5 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_InitializerInReplicator"), new object[] { seedActivity.QualifiedName }), 0x62d, false)
                        {
                            PropertyName = "CorrelationToken"
                        };
                        errors.Add(error5);
                    }
                    if (string.IsNullOrEmpty(qualifiedCorrelationToken))
                    {
                        return(errors);
                    }
                    if (seedActivity != null)
                    {
                        bool isValid = false;
                        System.Workflow.Activities.Common.Walker walker = new System.Workflow.Activities.Common.Walker();
                        walker.FoundActivity += delegate(System.Workflow.Activities.Common.Walker w, System.Workflow.Activities.Common.WalkerEventArgs args) {
                            if (args.CurrentActivity.Enabled && (args.CurrentActivity.QualifiedName == qualifiedCorrelationToken))
                            {
                                isValid     = true;
                                args.Action = System.Workflow.Activities.Common.WalkerAction.Abort;
                            }
                        };
                        walker.Walk(seedActivity);
                        if (!isValid)
                        {
                            ValidationError error6 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_CorrelationTokenInReplicator", new object[] { correlator.Name, seedActivity.QualifiedName }), new object[0]), 0x618, true)
                            {
                                PropertyName = "CorrelationToken"
                            };
                            errors.Add(error6);
                        }
                    }
                    if (flag2)
                    {
                        return(errors);
                    }
                    bool isValid                 = false;
                    bool ownerNameValidated      = false;
                    bool initFollowerInTxnlScope = false;
                    System.Workflow.Activities.Common.Walker walker2 = new System.Workflow.Activities.Common.Walker();
                    walker2.FoundActivity += delegate(System.Workflow.Activities.Common.Walker w, System.Workflow.Activities.Common.WalkerEventArgs args) {
                        Activity currentActivity = args.CurrentActivity;
                        if (currentActivity.Enabled && ((currentActivity is CallExternalMethodActivity) || (currentActivity is HandleExternalEventActivity)))
                        {
                            CorrelationToken token = currentActivity.GetValue((currentActivity is CallExternalMethodActivity) ? CallExternalMethodActivity.CorrelationTokenProperty : HandleExternalEventActivity.CorrelationTokenProperty) as CorrelationToken;
                            if (((token != null) && (!(currentActivity is CallExternalMethodActivity) || interfaceType.Equals(((CallExternalMethodActivity)currentActivity).InterfaceType))) && (!(currentActivity is HandleExternalEventActivity) || interfaceType.Equals(((HandleExternalEventActivity)currentActivity).InterfaceType)))
                            {
                                MemberInfo info = null;
                                if (currentActivity is CallExternalMethodActivity)
                                {
                                    if ((((CallExternalMethodActivity)currentActivity).MethodName == null) || (((CallExternalMethodActivity)currentActivity).MethodName.Length == 0))
                                    {
                                        return;
                                    }
                                    MethodInfo method = interfaceType.GetMethod(((CallExternalMethodActivity)currentActivity).MethodName, BindingFlags.Public | BindingFlags.Instance);
                                    if ((method == null) || method.IsSpecialName)
                                    {
                                        return;
                                    }
                                    info = method;
                                }
                                else
                                {
                                    if ((((HandleExternalEventActivity)currentActivity).EventName == null) || (((HandleExternalEventActivity)currentActivity).EventName.Length == 0))
                                    {
                                        return;
                                    }
                                    EventInfo info3 = interfaceType.GetEvent(((HandleExternalEventActivity)currentActivity).EventName, BindingFlags.Public | BindingFlags.Instance);
                                    if (info3 == null)
                                    {
                                        return;
                                    }
                                    info = info3;
                                }
                                attributes = info.GetCustomAttributes(typeof(CorrelationInitializerAttribute), false);
                                if (attributes.Length != 0)
                                {
                                    if (activity is HandleExternalEventActivity)
                                    {
                                        Activity transactionalScopeParent = GetTransactionalScopeParent(currentActivity);
                                        if ((transactionalScopeParent != null) && IsFollowerInTxnlScope(transactionalScopeParent, activity))
                                        {
                                            initFollowerInTxnlScope = true;
                                        }
                                    }
                                    sourceActivity = activity.GetActivityByName(token.OwnerActivityName);
                                    if (sourceActivity == null)
                                    {
                                        sourceActivity = Helpers.ParseActivityForBind(activity, token.OwnerActivityName);
                                    }
                                    if (sourceActivity != null)
                                    {
                                        string qualifiedName = sourceActivity.QualifiedName;
                                    }
                                    if ((correlator.Name == token.Name) && IsOwnerActivitySame(correlator.OwnerActivityName, token.OwnerActivityName, activity, currentActivity))
                                    {
                                        isValid            = true;
                                        ownerNameValidated = true;
                                        args.Action        = System.Workflow.Activities.Common.WalkerAction.Abort;
                                    }
                                }
                            }
                        }
                    };
                    walker2.Walk(activity3);
                    if (!isValid)
                    {
                        ValidationError error7 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_UninitializedCorrelation"), new object[0]), 0x538, true)
                        {
                            PropertyName = "CorrelationToken"
                        };
                        errors.Add(error7);
                        if (ownerNameValidated)
                        {
                            error7 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_MisMatchCorrelationTokenOwnerNameProperty"), new object[] { correlator.Name }), 0x538, false)
                            {
                                PropertyName = "CorrelationToken"
                            };
                            errors.Add(error7);
                        }
                    }
                    if (initFollowerInTxnlScope)
                    {
                        ValidationError error8 = new ValidationError(string.Format(CultureInfo.CurrentCulture, SR.GetString("Error_InitializerFollowerInTxnlScope"), new object[0]), 0x62e, false)
                        {
                            PropertyName = "CorrelationToken"
                        };
                        errors.Add(error8);
                    }
                }
            }
            return(errors);
        }