예제 #1
0
        protected override PSMemberInfoInternalCollection <T> GetMembers <T>(object obj)
        {
            PSMemberInfoInternalCollection <T> members = new PSMemberInfoInternalCollection <T>();

            if (typeof(T).IsAssignableFrom(typeof(PSProperty)))
            {
                this.DoAddAllProperties <T>(obj, members);
            }
            PSObject.dotNetInstanceAdapter.AddAllMethods <T>(obj, members, true);
            if (DotNetAdapter.IsTypeParameterizedProperty(typeof(T)))
            {
                PSMemberInfoInternalCollection <PSParameterizedProperty> internals2 = new PSMemberInfoInternalCollection <PSParameterizedProperty>();
                PSObject.dotNetInstanceAdapter.AddAllProperties <PSParameterizedProperty>(obj, internals2, true);
                foreach (PSParameterizedProperty property in internals2)
                {
                    try
                    {
                        members.Add(property as T);
                    }
                    catch (ExtendedTypeSystemException)
                    {
                    }
                }
            }
            return(members);
        }
예제 #2
0
        internal MethodInformation(string methodName, MethodBase method, int parametersToIgnore)
        {
            this.method           = method;
            this.methodDefinition = DotNetAdapter.GetMethodInfoOverloadDefinition(methodName, method, parametersToIgnore);
            this.isGeneric        = method.IsGenericMethod;
            ParameterInfo[] parameters = method.GetParameters();
            int             length     = parameters.Length - parametersToIgnore;

            this.parameters = new ParameterInformation[length];
            for (int index = 0; index < length; ++index)
            {
                this.parameters[index] = new ParameterInformation(parameters[index]);
                if (parameters[index].IsOptional)
                {
                    this.hasOptional = true;
                }
            }
            this.hasVarArgs = false;
            if (length <= 0)
            {
                return;
            }
            ParameterInfo parameterInfo = parameters[length - 1];

            if (this.hasOptional || !parameterInfo.ParameterType.IsArray || parameterInfo.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length == 0)
            {
                return;
            }
            this.hasVarArgs = true;
            this.parameters[length - 1].isParamArray = true;
        }
예제 #3
0
        protected override T GetMember <T>(object obj, string memberName)
        {
            PSProperty property = this.DoGetProperty(obj, memberName);

            if (typeof(T).IsAssignableFrom(typeof(PSProperty)) && (property != null))
            {
                return(property as T);
            }
            if (typeof(T).IsAssignableFrom(typeof(PSMethod)))
            {
                T dotNetMethod = PSObject.dotNetInstanceAdapter.GetDotNetMethod <T>(obj, memberName);
                if ((dotNetMethod != null) && (property == null))
                {
                    return(dotNetMethod);
                }
            }
            if (DotNetAdapter.IsTypeParameterizedProperty(typeof(T)))
            {
                PSParameterizedProperty dotNetProperty = PSObject.dotNetInstanceAdapter.GetDotNetProperty <PSParameterizedProperty>(obj, memberName);
                if ((dotNetProperty != null) && (property == null))
                {
                    return(dotNetProperty as T);
                }
            }
            return(default(T));
        }
        protected override T GetMember <T>(object obj, string memberName)
        {
            PSProperty dotNetProperty1 = this.GetDotNetProperty <PSProperty>(obj, memberName);

            if (typeof(T).IsAssignableFrom(typeof(PSProperty)) && dotNetProperty1 != null)
            {
                return(dotNetProperty1 as T);
            }
            if (typeof(T).Equals(typeof(PSMemberInfo)))
            {
                T dotNetMethod = PSObject.dotNetInstanceAdapter.GetDotNetMethod <T>(obj, memberName);
                if ((object)dotNetMethod != null && dotNetProperty1 == null)
                {
                    return(dotNetMethod);
                }
            }
            if (DotNetAdapter.IsTypeParameterizedProperty(typeof(T)))
            {
                PSParameterizedProperty dotNetProperty2 = PSObject.dotNetInstanceAdapter.GetDotNetProperty <PSParameterizedProperty>(obj, memberName);
                if (dotNetProperty2 != null && dotNetProperty1 == null)
                {
                    return(dotNetProperty2 as T);
                }
            }
            return(default(T));
        }
예제 #5
0
 public static PSMethod CreatePSMethod(string name, DotNetAdapter dotNetInstanceAdapter, object baseObject, MethodCacheEntry method, bool isSpecial, bool isHidden)
 {
     return(new PSMethod(
                name,
                dotNetInstanceAdapter,
                baseObject,
                method,
                isSpecial,
                isHidden));
 }
예제 #6
0
        public Sequence RefreshSequence(Sequence sequence, DataMessage dataMessage, object item, DataServiceTransaction dataServiceTransaction)
        {
            if (sequence.Parameters == null)
            {
                return(sequence);
            }
            DotNetAdapter dotNetAdapter = _dataDestination.ServiceAdapter as DotNetAdapter;

            if (dotNetAdapter != null)
            {
                bool isCreate = (dataMessage.operation == DataMessage.CreateOperation || dataMessage.operation == DataMessage.CreateAndSequenceOperation);
                int  fill     = dotNetAdapter.RefreshFill(sequence.Parameters, item, isCreate);
                switch (fill)
                {
                case Assembler.ExecuteFill:
                {
                    IList parameters = sequence.Parameters;
                    //if (parameters == null)
                    //    parameters = new object[0];
                    DataMessage fillDataMessage = new DataMessage();
                    fillDataMessage.clientId  = dataMessage.clientId;
                    fillDataMessage.operation = DataMessage.FillOperation;
                    fillDataMessage.body      = parameters != null ? parameters : new object[0];
                    IList result = _dataDestination.ServiceAdapter.Invoke(fillDataMessage) as IList;
                    return(CreateSequence(dataMessage.clientId as string, result, parameters, dataServiceTransaction));
                }

                case Assembler.AppendToFill:
                {
                    Identity identity = Identity.GetIdentity(item, _dataDestination);
                    if (!sequence.Contains(identity))
                    {
                        AddIdentityToSequence(sequence, identity, dataServiceTransaction);
                    }
                    _itemIdToItemHash[identity] = new ItemWrapper(item);
                }
                break;

                case Assembler.RemoveFromFill:
                {
                    Identity identity = Identity.GetIdentity(item, _dataDestination);
                    if (sequence.Contains(identity))
                    {
                        RemoveIdentityFromSequence(sequence, identity, dataServiceTransaction);
                    }
                }
                break;

                case Assembler.DoNotExecuteFill:
                    break;
                }
            }
            return(sequence);
        }
예제 #7
0
 internal void SetCodeReference(Type type, string methodName)
 {
     MemberInfo[] infoArray = type.GetMember(methodName, MemberTypes.Method, BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase);
     if (infoArray.Length != 1)
     {
         throw new ExtendedTypeSystemException("WrongMethodFormatFromTypeTable", null, ExtendedTypeSystem.CodeMethodMethodFormat, new object[0]);
     }
     this.codeReference                  = new MethodInfo[] { (MethodInfo)infoArray[0] };
     this.codeReferenceDefinition        = new string[] { DotNetAdapter.GetMethodInfoOverloadDefinition(null, this.codeReference[0], 0) };
     this.codeReferenceMethodInformation = DotNetAdapter.GetMethodInformationArray(this.codeReference);
     CheckMethodInfo(this.codeReference[0]);
 }
예제 #8
0
        private object CallConstructor(Type type, ConstructorInfo[] constructors, object[] args)
        {
            object obj2 = null;

            try
            {
                obj2 = DotNetAdapter.ConstructorInvokeDotNet(type, constructors, args);
            }
            catch (MethodException exception)
            {
                base.ThrowTerminatingError(new ErrorRecord(exception, "ConstructorInvokedThrowException", ErrorCategory.InvalidOperation, null));
            }
            return(obj2);
        }
예제 #9
0
 internal void SetCodeReference(Type type, string methodName)
 {
     MemberInfo[] member = type.GetMember(methodName, MemberTypes.Method, BindingFlags.IgnoreCase | BindingFlags.Static | BindingFlags.Public);
     this.codeReference = member.Length == 1 ? new MethodInfo[1]
     {
         (MethodInfo)member[0]
     } : throw new ExtendedTypeSystemException("WrongMethodFormatFromTypeTable", (Exception)null, "ExtendedTypeSystem", "CodeMethodMethodFormat", new object[0]);
     this.codeReferenceDefinition = new string[1]
     {
         DotNetAdapter.GetMethodInfoOverloadDefinition((string)null, (MethodBase)this.codeReference[0], 0)
     };
     this.codeReferenceMethodInformation = DotNetAdapter.GetMethodInformationArray((MethodBase[])this.codeReference);
     PSCodeMethod.CheckMethodInfo(this.codeReference[0]);
 }
예제 #10
0
 public override object Invoke(params object[] arguments)
 {
     object[] objArray2;
     if (arguments == null)
     {
         throw PSTraceSource.NewArgumentNullException("arguments");
     }
     object[] objArray = new object[arguments.Length + 1];
     objArray[0] = base.instance;
     for (int i = 0; i < arguments.Length; i++)
     {
         objArray[i + 1] = arguments[i];
     }
     Adapter.GetBestMethodAndArguments(this.codeReference[0].Name, this.codeReferenceMethodInformation, objArray, out objArray2);
     return(DotNetAdapter.AuxiliaryMethodInvoke(null, objArray2, this.codeReferenceMethodInformation[0], objArray));
 }
예제 #11
0
 public PSCodeMethod(string name, MethodInfo codeReference)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw PSTraceSource.NewArgumentException("name");
     }
     if (codeReference == null)
     {
         throw PSTraceSource.NewArgumentNullException("codeReference");
     }
     CheckMethodInfo(codeReference);
     base.name                           = name;
     this.codeReference                  = new MethodInfo[] { codeReference };
     this.codeReferenceDefinition        = new string[] { DotNetAdapter.GetMethodInfoOverloadDefinition(null, this.codeReference[0], 0) };
     this.codeReferenceMethodInformation = DotNetAdapter.GetMethodInformationArray(this.codeReference);
 }
예제 #12
0
        private Attribute GetCustomAttributeObject()
        {
            Type attribute = LanguagePrimitives.ConvertStringToAttribute(this._name);

            if (attribute == null)
            {
                throw InterpreterError.NewInterpreterException((object)this.NodeToken, typeof(RuntimeException), this.NodeToken, "CustomAttributeTypeNotFound", (object)this._name);
            }
            if (!attribute.IsSubclassOf(typeof(Attribute)))
            {
                throw InterpreterError.NewInterpreterException((object)this.NodeToken, typeof(RuntimeException), this.NodeToken, "InValidCustomAttributeType", (object)this._name);
            }
            try
            {
                if (this._arguments.Length == 0)
                {
                    ConstructorInfo constructor = attribute.GetConstructor(Type.EmptyTypes);
                    if (constructor != null)
                    {
                        if (constructor.IsPublic)
                        {
                            return((Attribute)DotNetAdapter.ConstructorInvokeDotNet(attribute, new ConstructorInfo[1]
                            {
                                constructor
                            }, this._arguments));
                        }
                    }
                }
                else
                {
                    ConstructorInfo[] constructors = attribute.GetConstructors();
                    if (constructors.Length != 0)
                    {
                        return((Attribute)DotNetAdapter.ConstructorInvokeDotNet(attribute, constructors, this._arguments));
                    }
                }
            }
            catch (RuntimeException ex)
            {
                if (ex.ErrorRecord.InvocationInfo == null)
                {
                    ex.ErrorRecord.SetInvocationInfo(new InvocationInfo((CommandInfo)null, this.NodeToken));
                }
                throw;
            }
            throw InterpreterError.NewInterpreterException((object)this.NodeToken, typeof(RuntimeException), this.NodeToken, "CannotFindConstructorForCustomAttribute", (object)this._name);
        }
예제 #13
0
        public Sequence RefreshSequence(Sequence sequence, DataMessage dataMessage, object item, DataServiceTransaction dataServiceTransaction)
        {
            if (sequence.Parameters != null)
            {
                DotNetAdapter serviceAdapter = this._dataDestination.ServiceAdapter as DotNetAdapter;
                if (serviceAdapter != null)
                {
                    Identity identity;
                    bool     isCreate = (dataMessage.operation == 0) || (dataMessage.operation == 11);
                    switch (serviceAdapter.RefreshFill(sequence.Parameters, item, isCreate))
                    {
                    case 0:
                        return(sequence);

                    case 1:
                    {
                        IList       parameters = sequence.Parameters;
                        DataMessage message    = new DataMessage {
                            clientId  = dataMessage.clientId,
                            operation = 1,
                            body      = (parameters != null) ? ((object)parameters) : ((object)new object[0])
                        };
                        IList result = this._dataDestination.ServiceAdapter.Invoke(message) as IList;
                        return(this.CreateSequence(dataMessage.clientId as string, result, parameters, dataServiceTransaction));
                    }

                    case 2:
                        identity = Identity.GetIdentity(item, this._dataDestination);
                        if (!sequence.Contains(identity))
                        {
                            this.AddIdentityToSequence(sequence, identity, dataServiceTransaction);
                        }
                        this._itemIdToItemHash[identity] = new ItemWrapper(item);
                        return(sequence);

                    case 3:
                        identity = Identity.GetIdentity(item, this._dataDestination);
                        if (sequence.Contains(identity))
                        {
                            this.RemoveIdentityFromSequence(sequence, identity, dataServiceTransaction);
                        }
                        return(sequence);
                    }
                }
            }
            return(sequence);
        }
예제 #14
0
        private object CallConstructor(Type type, ConstructorInfo[] constructors, object[] args)
        {
            object result = null;

            try
            {
                result = DotNetAdapter.ConstructorInvokeDotNet(type, constructors, args);
            }
            catch (MethodException e)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        e,
                        "ConstructorInvokedThrowException",
                        ErrorCategory.InvalidOperation, null));
            }
            // let other exceptions propagate
            return(result);
        }
예제 #15
0
        protected override PSMemberInfoInternalCollection <T> GetMembers <T>(
            object obj)
        {
            PSMemberInfoInternalCollection <T> members1 = new PSMemberInfoInternalCollection <T>();

            if (typeof(T).IsAssignableFrom(typeof(PSProperty)))
            {
                this.DoAddAllProperties <T>(obj, members1);
            }
            PSObject.dotNetInstanceAdapter.AddAllMethods <T>(obj, members1, true);
            if (DotNetAdapter.IsTypeParameterizedProperty(typeof(T)))
            {
                PSMemberInfoInternalCollection <PSParameterizedProperty> members2 = new PSMemberInfoInternalCollection <PSParameterizedProperty>();
                PSObject.dotNetInstanceAdapter.AddAllProperties <PSParameterizedProperty>(obj, members2, true);
                foreach (PSParameterizedProperty parameterizedProperty in (PSMemberInfoCollection <PSParameterizedProperty>)members2)
                {
                    members1.Add(parameterizedProperty as T);
                }
            }
            return(members1);
        }
예제 #16
0
        internal static object CallMethod(IScriptExtent errorPosition, object target, string methodName, PSMethodInvocationConstraints invocationConstraints, object[] paramArray, bool callStatic, object valueToSet)
        {
            PSMethodInfo      staticCLRMember   = null;
            MethodInformation methodInformation = null;
            object            obj2 = null;
            PSObject          obj3 = null;
            Type   type;
            object obj4;

            if (LanguagePrimitives.IsNull(target))
            {
                throw InterpreterError.NewInterpreterException(methodName, typeof(RuntimeException), errorPosition, "InvokeMethodOnNull", ParserStrings.InvokeMethodOnNull, new object[0]);
            }
            obj2 = PSObject.Base(target);
            obj3 = PSObject.AsPSObject(target);
            CallsiteCacheEntryFlags none = CallsiteCacheEntryFlags.None;

            if (callStatic)
            {
                none |= CallsiteCacheEntryFlags.Static;
                type  = (Type)obj2;
            }
            else
            {
                type = obj2.GetType();
            }
            if (valueToSet != AutomationNull.Value)
            {
                none |= CallsiteCacheEntryFlags.ParameterizedSetter;
            }
            if (!obj3.isDeserialized)
            {
                methodInformation = Adapter.FindCachedMethod(type, methodName, invocationConstraints, paramArray, none);
            }
            if (methodInformation == null)
            {
                if (callStatic)
                {
                    staticCLRMember = PSObject.GetStaticCLRMember(target, methodName) as PSMethod;
                }
                else
                {
                    staticCLRMember = obj3.Members[methodName] as PSMethodInfo;
                }
                if (staticCLRMember == null)
                {
                    string fullName = null;
                    if (callStatic)
                    {
                        fullName = type.FullName;
                    }
                    else
                    {
                        fullName = GetTypeFullName(target);
                    }
                    if (valueToSet == AutomationNull.Value)
                    {
                        throw InterpreterError.NewInterpreterException(methodName, typeof(RuntimeException), errorPosition, "MethodNotFound", ParserStrings.MethodNotFound, new object[] { fullName, methodName });
                    }
                    throw InterpreterError.NewInterpreterException(methodName, typeof(RuntimeException), errorPosition, "ParameterizedPropertyAssignmentFailed", ParserStrings.ParameterizedPropertyAssignmentFailed, new object[] { fullName, methodName });
                }
            }
            try
            {
                if (methodInformation != null)
                {
                    object[] objArray;
                    PSObject.memberResolution.WriteLine("cache hit, Calling Method: {0}", new object[] { methodInformation.methodDefinition });
                    if (valueToSet != AutomationNull.Value)
                    {
                        DotNetAdapter.ParameterizedPropertyInvokeSet(methodName, obj2, valueToSet, new MethodInformation[] { methodInformation }, paramArray, false);
                        return(valueToSet);
                    }
                    MethodInformation[] methods = new MethodInformation[] { methodInformation };
                    Adapter.GetBestMethodAndArguments(methodName, methods, paramArray, out objArray);
                    return(DotNetAdapter.AuxiliaryMethodInvoke(obj2, objArray, methodInformation, paramArray));
                }
                if (valueToSet != AutomationNull.Value)
                {
                    PSParameterizedProperty property = staticCLRMember as PSParameterizedProperty;
                    if (property == null)
                    {
                        throw InterpreterError.NewInterpreterException(methodName, typeof(RuntimeException), errorPosition, "ParameterizedPropertyAssignmentFailed", ParserStrings.ParameterizedPropertyAssignmentFailed, new object[] { GetTypeFullName(target), methodName });
                    }
                    property.InvokeSet(valueToSet, paramArray);
                    return(valueToSet);
                }
                PSMethod method = staticCLRMember as PSMethod;
                if (method != null)
                {
                    return(method.Invoke(invocationConstraints, paramArray));
                }
                obj4 = staticCLRMember.Invoke(paramArray);
            }
            catch (MethodInvocationException exception)
            {
                if (exception.ErrorRecord.InvocationInfo == null)
                {
                    exception.ErrorRecord.SetInvocationInfo(new InvocationInfo(null, errorPosition));
                }
                throw;
            }
            catch (RuntimeException exception2)
            {
                if (exception2.ErrorRecord.InvocationInfo == null)
                {
                    exception2.ErrorRecord.SetInvocationInfo(new InvocationInfo(null, errorPosition));
                }
                throw;
            }
            catch (FlowControlException)
            {
                throw;
            }
            catch (ScriptCallDepthException)
            {
                throw;
            }
            catch (Exception exception3)
            {
                CommandProcessorBase.CheckForSevereException(exception3);
                throw InterpreterError.NewInterpreterExceptionByMessage(typeof(RuntimeException), errorPosition, exception3.Message, "MethodInvocationException", exception3);
            }
            return(obj4);
        }
예제 #17
0
        public override DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
        {
            bool flag;
            Type type = (Type)target.Value;

            MethodInformation[] methodInformationArray = DotNetAdapter.GetMethodInformationArray(type.GetConstructors());
            target = new DynamicMetaObject(target.Expression, BindingRestrictions.GetInstanceRestriction(target.Expression, target.Value), target.Value);
            string            errorId     = null;
            string            errorMsg    = null;
            int               count       = base.CallInfo.ArgumentCount - base.CallInfo.ArgumentNames.Count;
            MethodInformation information = Adapter.FindBestMethod(methodInformationArray, null, (from arg in args.Take <DynamicMetaObject>(count) select arg.Value).ToArray <object>(), ref errorId, ref errorMsg, out flag);

            if (information == null)
            {
                if (errorSuggestion == null)
                {
                }
                return(new DynamicMetaObject(Expression.Throw(Expression.New(CachedReflectionInfo.MethodException_ctor, new Expression[] { Expression.Constant(errorId), Expression.Constant(null, typeof(Exception)), Expression.Constant(errorMsg), Expression.NewArrayInit(typeof(object), new Expression[] { Expression.Constant(".ctor").Cast(typeof(object)), ExpressionCache.Constant(count).Cast(typeof(object)) }) }), this.ReturnType), target.CombineRestrictions(args)));
            }
            ConstructorInfo method = (ConstructorInfo)information.method;

            ParameterInfo[] parameters = method.GetParameters();
            Expression[]    arguments  = new Expression[parameters.Length];
            int             index      = 0;

            while (index < parameters.Length)
            {
                bool flag3;
                Type parameterType = parameters[index].ParameterType;
                if (parameters[index].GetCustomAttributes(typeof(ParamArrayAttribute), true).Any <object>() && flag)
                {
                    Type elementType = parameters[index].ParameterType.GetElementType();
                    List <Expression> initializers = new List <Expression>();
                    int num3 = index;
                    int num4 = index;
                    while (num4 < count)
                    {
                        bool flag2;
                        LanguagePrimitives.ConversionData data = LanguagePrimitives.FigureConversion(args[index].Value, elementType, out flag2);
                        initializers.Add(PSConvertBinder.InvokeConverter(data, args[num4].Expression, elementType, flag2, ExpressionCache.InvariantCulture));
                        num4++;
                        index++;
                    }
                    arguments[num3] = Expression.NewArrayInit(elementType, initializers);
                    break;
                }
                LanguagePrimitives.ConversionData conversion = LanguagePrimitives.FigureConversion(args[index].Value, parameterType, out flag3);
                arguments[index] = PSConvertBinder.InvokeConverter(conversion, args[index].Expression, parameterType, flag3, ExpressionCache.InvariantCulture);
                index++;
            }
            Expression right = Expression.New(method, arguments);

            if (base.CallInfo.ArgumentNames.Any <string>())
            {
                ParameterExpression expr        = Expression.Parameter(right.Type);
                List <Expression>   expressions = new List <Expression>();
                foreach (string str3 in base.CallInfo.ArgumentNames)
                {
                    Expression   expression3;
                    Type         propertyType;
                    bool         flag4;
                    MemberInfo[] infoArray3 = type.GetMember(str3, MemberTypes.Property | MemberTypes.Field, BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
                    if ((infoArray3.Length != 1) || (!(infoArray3[0] is PropertyInfo) && !(infoArray3[0] is FieldInfo)))
                    {
                        return(target.ThrowRuntimeError(args, BindingRestrictions.Empty, "PropertyNotFoundForType", ParserStrings.PropertyNotFoundForType, new Expression[] { Expression.Constant(str3), Expression.Constant(type) }));
                    }
                    MemberInfo info2 = infoArray3[0];
                    if (info2 is PropertyInfo)
                    {
                        PropertyInfo property = (PropertyInfo)info2;
                        if (property.GetSetMethod() == null)
                        {
                            return(target.ThrowRuntimeError(args, BindingRestrictions.Empty, "PropertyIsReadOnly", ParserStrings.PropertyIsReadOnly, new Expression[] { Expression.Constant(str3) }));
                        }
                        propertyType = property.PropertyType;
                        expression3  = Expression.Property(expr.Cast(info2.DeclaringType), property);
                    }
                    else
                    {
                        propertyType = ((FieldInfo)info2).FieldType;
                        expression3  = Expression.Field(expr.Cast(info2.DeclaringType), (FieldInfo)info2);
                    }
                    LanguagePrimitives.ConversionData data3 = LanguagePrimitives.FigureConversion(args[index].Value, propertyType, out flag4);
                    if (data3.Rank == ConversionRank.None)
                    {
                        return(PSConvertBinder.ThrowNoConversion(args[index], propertyType, this, -1, args.Except <DynamicMetaObject>(new DynamicMetaObject[] { args[index] }).Prepend <DynamicMetaObject>(target).ToArray <DynamicMetaObject>()));
                    }
                    expressions.Add(Expression.Assign(expression3, PSConvertBinder.InvokeConverter(data3, args[index].Expression, propertyType, flag4, ExpressionCache.InvariantCulture)));
                    index++;
                }
                ParameterExpression variable    = Expression.Parameter(typeof(Exception));
                BlockExpression     expression5 = Expression.Block(Expression.Assign(expr, right), Expression.TryCatch(Expression.Block(typeof(void), expressions), new CatchBlock[] { Expression.Catch(variable, Expression.Block(Expression.Call(CachedReflectionInfo.CommandProcessorBase_CheckForSevereException, variable), Compiler.ThrowRuntimeErrorWithInnerException("PropertyAssignmentException", Expression.Property(variable, "Message"), variable, typeof(void), new Expression[0]))) }), expr);
                right = Expression.Block(new ParameterExpression[] { expr }, new Expression[] { expression5 });
            }
            return(new DynamicMetaObject(right, target.CombineRestrictions(args)));
        }