Пример #1
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void Init(Type objectType, String[] memberNames, Type[] memberTypes, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
        {
            SerTrace.Log(this, objectInfoId, " Constructor 5 ", objectType);
            this.objectType         = objectType;
            this.objectManager      = objectManager;
            this.wireMemberNames    = memberNames;
            this.wireMemberTypes    = memberTypes;
            this.context            = context;
            this.serObjectInfoInit  = serObjectInfoInit;
            this.formatterConverter = converter;
            this.bSimpleAssembly    = bSimpleAssembly;
            if (memberNames != null)
            {
                isNamed = true;
            }
            if (memberTypes != null)
            {
                isTyped = true;
            }

            if ((object)objectType != null)
            {
                InitReadConstructor(objectType, surrogateSelector, context);
            }
        }
Пример #2
0
        // Get the ObjectType for a memberName
        internal Type GetType(String name)
        {
            SerTrace.Log(this, objectInfoId, " ", objectType, " GetType Entry ", name);
            Type type     = null;
            int  position = Position(name);

            if (position == -1)
            {
                return(null);
            }

            if (isTyped)
            {
                type = cache.memberTypes[position];
            }
            else
            {
                type = (Type)memberTypesList[position];
            }

            if ((object)type == null)
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_ISerializableTypes", objectType + " " + name));
            }

            SerTrace.Log(this, objectInfoId, " ", objectType, " GetType Exit ", type);
            return(type);
        }
Пример #3
0
 private void DumpPopulate(MemberInfo[] memberInfos, Object[] memberData)
 {
     for (int i = 0; i < memberInfos.Length; i++)
     {
         SerTrace.Log(this, objectInfoId, " ", objectType, " PopulateObjectMembers ", memberInfos[i].Name, " ", memberData[i]);
     }
 }
Пример #4
0
        internal String GetAssemblyString()
        {
            SerTrace.Log(this, objectInfoId, " ", objectType, " GetAssemblyString Entry isSi ", isSi, " ", cache.assemblyString);

            this.binderAssemblyString = BinaryFormatterMinifier.AssemblyOrTypeNameMinifier(binderAssemblyString);
            return(binderAssemblyString ?? cache.assemblyString);
        }
Пример #5
0
        // Specifies the position in the memberNames array of this name

        private int Position(String name)
        {
            SerTrace.Log(this, objectInfoId, " Position ", lastPosition, " ", name);
            if (cache == null)
            {
                return(-1);
            }

            if (cache.memberNames.Length > 0 && cache.memberNames[lastPosition].Equals(name))
            {
                return(lastPosition);
            }
            else if ((++lastPosition < cache.memberNames.Length) && (cache.memberNames[lastPosition].Equals(name)))
            {
                return(lastPosition);
            }
            else
            {
                // Search for name
                SerTrace.Log(this, objectInfoId, " Position miss search for name " + name);
                for (int i = 0; i < cache.memberNames.Length; i++)
                {
                    if (cache.memberNames[i].Equals(name))
                    {
                        lastPosition = i;
                        return(lastPosition);
                    }
                }

                //throw new SerializationException(String.Format(ModifiedVulnerableBinaryFormatters.binary.Environment.GetResourceString("Serialization_MissingMember"),name,objectType));
                lastPosition = 0;
                return(-1);
            }
        }
Пример #6
0
        private static int primitiveTypeEnumLength = 17; //Number of PrimitiveTypeEnums

        // The following section are utilities to read and write XML types

        internal static InternalPrimitiveTypeE ToCode(Type type)
        {
            SerTrace.Log("Converter", "ToCode Type Entry ", type);
            InternalPrimitiveTypeE code;

            if ((object)type != null && !type.IsPrimitive)
            {
                if (Object.ReferenceEquals(type, typeofDateTime))
                {
                    code = InternalPrimitiveTypeE.DateTime;
                }
                else if (Object.ReferenceEquals(type, typeofTimeSpan))
                {
                    code = InternalPrimitiveTypeE.TimeSpan;
                }
                else if (Object.ReferenceEquals(type, typeofDecimal))
                {
                    code = InternalPrimitiveTypeE.Decimal;
                }
                else
                {
                    code = InternalPrimitiveTypeE.Invalid;
                }
            }
            else
            {
                code = ToPrimitiveTypeEnum(Type.GetTypeCode(type));
            }

            SerTrace.Log("Converter", "ToCode Exit ", ((Enum)code).ToString());
            return(code);
        }
Пример #7
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void Fixup(ParseRecord record, ParseRecord parent)
        {
            Object obj = record.PRnewObj;

#if _DEBUG
            SerTrace.Log(this, "Fixup ", obj, " ", ((Enum)valueFixupEnum).ToString());
#endif
            switch (valueFixupEnum)
            {
            case ValueFixupEnum.Array:
                arrayObj.SetValue(obj, indexMap);
                break;

            case ValueFixupEnum.Header:
                Type type = typeof(Header);
                if (valueInfo == null)
                {
                    MemberInfo[] valueInfos = type.GetMember("Value");
                    if (valueInfos.Length != 1)
                    {
                        throw new SerializationException(Environment.GetResourceString("Serialization_HeaderReflection", valueInfos.Length));
                    }
                    valueInfo = valueInfos[0];
                }

                Assembly mscorlibAsm           = Assembly.Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
                var      FormatterServicesRef  = mscorlibAsm.GetType("System.Runtime.Serialization.FormatterServices");
                var      serializationSetValue = FormatterServicesRef.GetMethod("SerializationSetValue", BindingFlags.Static | BindingFlags.NonPublic);
                serializationSetValue.Invoke(null, new object[] { valueInfo, header, obj });

                //FormatterServices.SerializationSetValue(valueInfo, header, obj);
                break;

            case ValueFixupEnum.Member:
                SerTrace.Log(this, "Fixup Member new object value ", obj, " memberObject ", memberObject);

                if (objectInfo.isSi)
                {
                    /*SerTrace.Log(this, "Recording a fixup on member: ", memberName,
                     *           " in object id", parent.PRobjectId, " Required Object ", record.PRobjectId);*/
                    objectInfo.objectManager.RecordDelayedFixup(parent.PRobjectId, memberName, record.PRobjectId);
//                          Console.WriteLine("SerializationInfo: Main Object ({0}): {1}. SubObject ({2}): {3}", parent.PRobjectId,
//                                            objectInfo.obj, record.PRobjectId, obj);
                }
                else
                {
                    MemberInfo memberInfo = objectInfo.GetMemberInfo(memberName);

                    /*SerTrace.Log(this, "Recording a fixup on member:", memberInfo, " in object id ",
                     *           parent.PRobjectId," Required Object", record.PRobjectId);*/
                    if (memberInfo != null)
                    {
                        objectInfo.objectManager.RecordFixup(parent.PRobjectId, memberInfo, record.PRobjectId);
                    }
//                          Console.WriteLine("MemberFixup: Main Object({0}): {1}. SubObject({2}): {3}", parent.PRobjectId,
//                                            objectInfo.obj.GetType(), record.PRobjectId, obj.GetType());
                }
                break;
            }
        }
Пример #8
0
 private void DumpMemberInfo()
 {
     for (int i = 0; i < cache.memberInfos.Length; i++)
     {
         SerTrace.Log(this, objectInfoId, " Constructor 1 memberInfos data ", cache.memberInfos[i].Name, " ", memberData[i]);
     }
 }
Пример #9
0
        [System.Security.SecurityCritical]  // auto-generated
        internal Object Deserialize(Stream serializationStream, HeaderHandler handler, bool fCheck, bool isCrossAppDomain, IMethodCallMessage methodCallMessage)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream", ModifiedVulnerableBinaryFormatters.binary.Environment.GetResourceString("ArgumentNull_WithParamName", serializationStream));
            }
            Contract.EndContractBlock();

            if (serializationStream.CanSeek && (serializationStream.Length == 0))
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_Stream"));
            }

            SerTrace.Log(this, "Deserialize Entry");
            InternalFE formatterEnums = new InternalFE();

            formatterEnums.FEtypeFormat         = m_typeFormat;
            formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Binary;
            formatterEnums.FEassemblyFormat     = m_assemblyFormat;
            formatterEnums.FEsecurityLevel      = m_securityLevel;

            ObjectReader sor = new ObjectReader(serializationStream, m_surrogates, m_context, formatterEnums, m_binder);

            sor.crossAppDomainArray = m_crossAppDomainArray;
            return(sor.Deserialize(handler, new __BinaryParser(serializationStream, sor), fCheck, isCrossAppDomain, methodCallMessage));
        }
Пример #10
0
        // Get the memberInfo for a memberName
        internal MemberInfo GetMemberInfo(String name)
        {
            SerTrace.Log(this, objectInfoId, " ", objectType, " GetMemberInfo Entry ", name);
            if (cache == null)
            {
                return(null);
            }
            if (isSi)
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_MemberInfo", objectType + " " + name));
            }
            if (cache.memberInfos == null)
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_NoMemberInfo", objectType + " " + name));
            }
            int position = Position(name);

            if (position != -1)
            {
                return(cache.memberInfos[Position(name)]);
            }
            else
            {
                return(null);
            }
        }
Пример #11
0
        private int nullCount = 0; //Count of consecutive array nulls

        // Constructor
        internal __BinaryWriter(Stream sout, ObjectWriter objectWriter, FormatterTypeStyle formatterTypeStyle)
        {
            SerTrace.Log(this, "BinaryWriter ");
            this.sout = sout;
            this.formatterTypeStyle = formatterTypeStyle;
            this.objectWriter       = objectWriter;
            m_nestedObjectCount     = 0;
            dataWriter = new BinaryWriter(sout, Encoding.UTF8);
        }
Пример #12
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder)
        {
            SerTrace.Log(this, objectInfoId, " Constructor 2 ", objectType);

            this.objectType        = objectType;
            this.context           = context;
            this.serObjectInfoInit = serObjectInfoInit;

            if (objectType.IsArray)
            {
                InitNoMembers();
                return;
            }

            InvokeSerializationBinder(binder);

            ISurrogateSelector surrogateSelectorTemp = null;

            if (surrogateSelector != null)
            {
                serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);
            }

            if (serializationSurrogate != null)
            {
                // surrogate does not have this problem since user has pass in through the BF's ctor
                si    = new SerializationInfo(objectType, converter);
                cache = new SerObjectInfoCache(objectType);

                isSi = true;
            }
            else if (Object.ReferenceEquals(objectType, Converter.typeofObject))
            {
            }
            else if (Converter.typeofISerializable.IsAssignableFrom(objectType))
            {
                Assembly mscorlibAsm                         = Assembly.Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
                var      FormatterServicesRef                = mscorlibAsm.GetType("System.Runtime.Serialization.FormatterServices");
                var      unsafeTypeForwardersIsEnabled       = FormatterServicesRef.GetMethod("UnsafeTypeForwardersIsEnabled", BindingFlags.Static | BindingFlags.NonPublic);
                var      unsafeTypeForwardersIsEnabledResult = (bool)unsafeTypeForwardersIsEnabled.Invoke(null, new object[] { });
                si = new SerializationInfo(objectType, converter, !unsafeTypeForwardersIsEnabledResult);

                //si = new SerializationInfo(objectType, converter, !FormatterServices.UnsafeTypeForwardersIsEnabled());
                cache = new SerObjectInfoCache(objectType);
                CheckTypeForwardedFrom(cache, objectType, binderAssemblyString);

                isSi = true;
            }

            if (!isSi)
            {
                InitMemberInfo();
                CheckTypeForwardedFrom(cache, objectType, binderAssemblyString);
            }

            SerTrace.Log(this, objectInfoId, " ", objectType, " InitSerialize Exit ", isSi);
        }
Пример #13
0
        internal ValueFixup(Array arrayObj, int[] indexMap)
        {
#if _DEBUG
            SerTrace.Log(this, "Array Constructor ", arrayObj);
#endif
            valueFixupEnum = ValueFixupEnum.Array;
            this.arrayObj  = arrayObj;
            this.indexMap  = indexMap;
        }
Пример #14
0
 private void InitNoMembers()
 {
     cache = (SerObjectInfoCache)serObjectInfoInit.seenBeforeTable[objectType];
     if (cache == null)
     {
         SerTrace.Log(this, objectInfoId, " ", objectType, " InitMemberInfo new cache");
         cache = new SerObjectInfoCache(objectType);
         serObjectInfoInit.seenBeforeTable.Add(objectType, cache);
     }
 }
Пример #15
0
        internal ValueFixup(Object memberObject, String memberName, ReadObjectInfo objectInfo)
        {
#if _DEBUG
            SerTrace.Log(this, "Member Constructor ", memberObject);
#endif
            valueFixupEnum    = ValueFixupEnum.Member;
            this.memberObject = memberObject;
            this.memberName   = memberName;
            this.objectInfo   = objectInfo;
        }
Пример #16
0
        internal void Dump()
        {
            for (int i = 0; i < Count(); i++)
            {
                Object obj = objects[i];
#if _DEBUG
                SerTrace.Log(this, "Stack Dump ", stackId, " " + ((obj is ITrace)?((ITrace)obj).Trace():""));
#endif
            }
        }
Пример #17
0
        // Returns a COM runtime type associated with the type  code

        internal static Type ToType(InternalPrimitiveTypeE code)
        {
            SerTrace.Log("Converter", "ToType Entry ", ((Enum)code).ToString());
            if (typeA == null)
            {
                InitTypeA();
            }
            SerTrace.Log("Converter", "ToType Exit ", (((object)typeA[(int)code] == null)?"null ":typeA[(int)code].Name));
            return(typeA[(int)code]);
        }
Пример #18
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void PopulateObjectMembers(Object obj, Object[] memberData)
        {
            SerTrace.Log(this, objectInfoId, " ", objectType, " PopulateObjectMembers  isSi ", isSi);
            if (!isSi && memberData != null)
            {
                DumpPopulate(cache.memberInfos, memberData);

                FormatterServices.PopulateObjectMembers(obj, cache.memberInfos, memberData);
            }
        }
Пример #19
0
        // Gets the second entry in the stack.
        internal Object PeekPeek()
        {
            if (top < 1)
            {
                return(null);
            }
#if _DEBUG
            SerTrace.Log(this, "PeekPeek ", stackId, " ", ((objects[top - 1] is ITrace)?((ITrace)objects[top - 1]).Trace():""));
#endif
            return(objects[top - 1]);
        }
Пример #20
0
        // Push the object onto the stack
        internal void Push(Object obj)
        {
#if _DEBUG
            SerTrace.Log(this, "Push ", stackId, " ", ((obj is ITrace)?((ITrace)obj).Trace():""));
#endif
            if (top == (objects.Length - 1))
            {
                IncreaseCapacity();
            }
            objects[++top] = obj;
        }
Пример #21
0
        internal void WriteMember(NameInfo memberNameInfo, NameInfo typeNameInfo, Object value)
        {
#if _DEBUG
            SerTrace.Log("BinaryWriter", "Write Member memberName ", memberNameInfo.NIname, ", value ", value);
            memberNameInfo.Dump("WriteMember memberNameInfo");
            typeNameInfo.Dump("WriteMember typeNameInfo");
#endif
            InternalWriteItemNull();
            InternalPrimitiveTypeE typeInformation = typeNameInfo.NIprimitiveTypeEnum;

            // Writes Members with primitive values

            if (memberNameInfo.NItransmitTypeOnMember)
            {
                if (memberPrimitiveTyped == null)
                {
                    memberPrimitiveTyped = new MemberPrimitiveTyped();
                }
                memberPrimitiveTyped.Set((InternalPrimitiveTypeE)typeInformation, value);

                if (memberNameInfo.NIisArrayItem)
                {
                    BCLDebug.Trace("BINARY", "-----item-----");
                }
                else
                {
                    BCLDebug.Trace("BINARY", "-----", memberNameInfo.NIname, "-----");
                }
                memberPrimitiveTyped.Dump();

                memberPrimitiveTyped.Write(this);
            }
            else
            {
                if (memberPrimitiveUnTyped == null)
                {
                    memberPrimitiveUnTyped = new MemberPrimitiveUnTyped();
                }
                memberPrimitiveUnTyped.Set(typeInformation, value);

                if (memberNameInfo.NIisArrayItem)
                {
                    BCLDebug.Trace("BINARY", "-----item-----");
                }
                else
                {
                    BCLDebug.Trace("BINARY", "-----", memberNameInfo.NIname, "-----");
                }
                memberPrimitiveUnTyped.Dump();

                memberPrimitiveUnTyped.Write(this);
            }
        }
Пример #22
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void Init(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
        {
            SerTrace.Log(this, objectInfoId, " Constructor 3 ", objectType);

            this.objectType         = objectType;
            this.objectManager      = objectManager;
            this.context            = context;
            this.serObjectInfoInit  = serObjectInfoInit;
            this.formatterConverter = converter;
            this.bSimpleAssembly    = bSimpleAssembly;

            InitReadConstructor(objectType, surrogateSelector, context);
        }
Пример #23
0
        // Returns a String containg a COM+ runtime type associated with the type code

        internal static String ToComType(InternalPrimitiveTypeE code)
        {
            SerTrace.Log("Converter", "ToComType Entry ", ((Enum)code).ToString());

            if (valueA == null)
            {
                InitValueA();
            }

            SerTrace.Log("Converter", "ToComType Exit ", ((valueA[(int)code] == null)?"null":valueA[(int)code]));

            return(valueA[(int)code]);
        }
Пример #24
0
        // Pop the object from the stack
        internal Object Pop()
        {
            if (top < 0)
            {
                return(null);
            }

            Object obj = objects[top];

            objects[top--] = null;
#if _DEBUG
            SerTrace.Log(this, "Pop ", stackId, " ", ((obj is ITrace)?((ITrace)obj).Trace():""));
#endif
            return(obj);
        }
Пример #25
0
 // Records an objectId in a member when the actual object for that member is not yet known
 internal void RecordFixup(long objectId, String name, long idRef)
 {
     if (isSi)
     {
         SerTrace.Log(this, objectInfoId, " ", objectType, " RecordFixup  RecordDelayedFixup objectId ", objectId, " name ", name, " idRef ", idRef, " isSi ", isSi);
         objectManager.RecordDelayedFixup(objectId, name, idRef);
     }
     else
     {
         SerTrace.Log(this, objectInfoId, " ", objectType, " RecordFixup  objectId ", objectId, " name ", name, " idRef ", idRef, " isSi ", isSi);
         int position = Position(name);
         if (position != -1)
         {
             objectManager.RecordFixup(objectId, cache.memberInfos[position], idRef);
         }
     }
 }
Пример #26
0
        // Translates a string into an Object
        internal static Object FromString(String value, InternalPrimitiveTypeE code)
        {
            Object var;

            SerTrace.Log("Converter", "FromString Entry ", value, " ", ((Enum)code).ToString());
            // InternalPrimitiveTypeE needs to be a primitive type
            //Contract.Assert((code != InternalPrimitiveTypeE.Invalid), "[Converter.FromString]!InternalPrimitiveTypeE.Invalid ");
            if (code != InternalPrimitiveTypeE.Invalid)
            {
                var = Convert.ChangeType(value, ToTypeCode(code), CultureInfo.InvariantCulture);
            }
            else
            {
                var = value;
            }
            SerTrace.Log("Converter", "FromString Exit " + ((var == null)?"null":var + " var type " + ((var == null)?"<null>":var.GetType().ToString())));
            return(var);
        }
Пример #27
0
        internal void Dump()
        {
            SerTrace.Log("ParseRecord Dump ", PRparseRecordId);
            SerTrace.Log("Enums");
            Util.NVTrace("ParseType", ((Enum)PRparseTypeEnum).ToString());
            Util.NVTrace("ObjectType", ((Enum)PRobjectTypeEnum).ToString());
            Util.NVTrace("ArrayType", ((Enum)PRarrayTypeEnum).ToString());
            Util.NVTrace("MemberType", ((Enum)PRmemberTypeEnum).ToString());
            Util.NVTrace("MemberValue", ((Enum)PRmemberValueEnum).ToString());
            Util.NVTrace("ObjectPosition", ((Enum)PRobjectPositionEnum).ToString());
            SerTrace.Log("Basics");
            Util.NVTrace("Name", PRname);
            Util.NVTrace("Value ", PRvalue);
            Util.NVTrace("varValue ", PRvarValue);
            if (PRvarValue != null)
            {
                Util.NVTrace("varValue type", PRvarValue.GetType());
            }

            Util.NVTrace("keyDt", PRkeyDt);
            Util.NVTrace("dtType", PRdtType);
            Util.NVTrace("code", ((Enum)PRdtTypeCode).ToString());
            Util.NVTrace("objectID", PRobjectId);
            Util.NVTrace("idRef", PRidRef);
            Util.NVTrace("isEnum", PRisEnum);
            SerTrace.Log("Array ");
            Util.NVTrace("arrayElementTypeString", PRarrayElementTypeString);
            Util.NVTrace("arrayElementType", PRarrayElementType);
            Util.NVTrace("arrayElementTypeCode", ((Enum)PRarrayElementTypeCode).ToString());
            Util.NVTrace("isArrayVariant", PRisArrayVariant);
            Util.NVTrace("rank", PRrank);
            Util.NVTrace("dimensions", Util.PArray(PRlengthA));
            Util.NVTrace("position", Util.PArray(PRpositionA));
            Util.NVTrace("lowerBoundA", Util.PArray(PRlowerBoundA));
            Util.NVTrace("upperBoundA", Util.PArray(PRupperBoundA));
            SerTrace.Log("Header ");
            Util.NVTrace("nullCount", PRnullCount);

            SerTrace.Log("New Object");
            if (PRnewObj != null)
            {
                Util.NVTrace("newObj", PRnewObj);
            }
        }
Пример #28
0
        // Adds the value for a memberName
        internal void AddValue(String name, Object value, ref SerializationInfo si, ref Object[] memberData)
        {
            SerTrace.Log(this, objectInfoId, " ", objectType, " AddValue ", name, " ", value, " isSi ", isSi);
            if (isSi)
            {
                si.AddValue(name, value);
            }
            else
            {
                //                Console.WriteLine("Calling add value for " + name + " with value " + value);
                int position = Position(name);

                // If a member in the stream is not found, ignore it
                if (position != -1)
                {
                    memberData[position] = value;
                }
            }
        }
Пример #29
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void Serialize(Stream serializationStream, Object graph, Header[] headers, bool fCheck)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream", Environment.GetResourceString("ArgumentNull_WithParamName", serializationStream));
            }
            Contract.EndContractBlock();
            SerTrace.Log(this, "Serialize Entry");

            InternalFE formatterEnums = new InternalFE();

            formatterEnums.FEtypeFormat         = m_typeFormat;
            formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Binary;
            formatterEnums.FEassemblyFormat     = m_assemblyFormat;

            ObjectWriter   sow          = new ObjectWriter(m_surrogates, m_context, formatterEnums, m_binder);
            __BinaryWriter binaryWriter = new __BinaryWriter(serializationStream, sow, m_typeFormat);

            sow.Serialize(graph, headers, binaryWriter, fCheck);
            m_crossAppDomainArray = sow.crossAppDomainArray;
        }
Пример #30
0
        // Retrieves the member type from the MemberInfo
        internal Type GetMemberType(MemberInfo objMember)
        {
            Type objectType = null;

            if (objMember is FieldInfo)
            {
                objectType = ((FieldInfo)objMember).FieldType;
                SerTrace.Log(this, objectInfoId, " ", "GetMemberType FieldInfo ", objectType);
            }
            else if (objMember is PropertyInfo)
            {
                objectType = ((PropertyInfo)objMember).PropertyType;
                SerTrace.Log(this, objectInfoId, " ", "GetMemberType PropertyInfo ", objectType);
            }
            else
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_SerMemberInfo", objMember.GetType()));
            }

            return(objectType);
        }