protected OrderedDictionary(SerializationInfo info, StreamingContext context)
 {
     // We can't do anything with the keys and values until the entire graph has been deserialized
     // and getting Counts and objects won't fail.  For the time being, we'll just cache this.
     // The graph is not valid until OnDeserialization has been called.
     _siInfo = info;
 }
 protected MasterDataBusinessLogicCountDimensionValuesAsyncOperationException(
     SerializationInfo?info,
     StreamingContext context)
     : base(
         info, context)
 {
 }
示例#3
0
        public virtual void OnDeserialization(object sender)
        {
            if (_siInfo == null)
            {
                return; //Somebody had a dependency on this LinkedList and fixed us up before the ObjectManager got to it.
            }

            int realVersion = _siInfo.GetInt32(VersionName);
            int count       = _siInfo.GetInt32(CountName);

            if (count != 0)
            {
                T[]? array = (T[]?)_siInfo.GetValue(ValuesName, typeof(T[]));

                if (array == null)
                {
                    throw new SerializationException(SR.Serialization_MissingValues);
                }
                for (int i = 0; i < array.Length; i++)
                {
                    AddLast(array[i]);
                }
            }
            else
            {
                head = null;
            }

            version = realVersion;
            _siInfo = null;
        }
示例#4
0
        // Initialize ParseRecord. Called when reusing.
        internal void Init()
        {
            // Enums
            _parseTypeEnum      = InternalParseTypeE.Empty;
            _objectTypeEnum     = InternalObjectTypeE.Empty;
            _arrayTypeEnum      = InternalArrayTypeE.Empty;
            _memberTypeEnum     = InternalMemberTypeE.Empty;
            _memberValueEnum    = InternalMemberValueE.Empty;
            _objectPositionEnum = InternalObjectPositionE.Empty;

            // Object
            _name = null;

            // Value
            _value = null;

            // dt attribute
            _keyDt      = null;
            _dtType     = null;
            _dtTypeCode = InternalPrimitiveTypeE.Invalid;

            // Object ID
            _objectId = 0;

            // Reference ID
            _idRef = 0;

            // Array

            // Array Element Type
            _arrayElementTypeString = null;
            _arrayElementType       = null;
            _isArrayVariant         = false;
            _arrayElementTypeCode   = InternalPrimitiveTypeE.Invalid;

            // Parsed array information
            _rank        = 0;
            _lengthA     = null;
            _lowerBoundA = null;

            // Array map for placing array elements in array
            _indexMap       = null;
            _memberIndex    = 0;
            _linearlength   = 0;
            _rectangularMap = null;
            _isLowerBound   = false;

            // ValueType Fixup needed
            _isValueTypeFixup = false;

            _newObj         = null;
            _objectA        = null;
            _primitiveArray = null;
            _objectInfo     = null;
            _isRegistered   = false;
            _memberData     = null;
            _si             = null;

            _consecutiveNullArrayEntryCount = 0;
        }
示例#5
0
 protected MasterDataBusinessLogicNoSuchDimensionDimensionValueEntity(
     SerializationInfo?info,
     StreamingContext context)
     : base(
         info,
         context)
 {
 }
示例#6
0
 protected ControlPanelWebApiClientFindModuleAsyncOperationException(
     SerializationInfo?info,
     StreamingContext context)
     : base(
         info,
         context)
 {
 }
示例#7
0
 private static SerializationInfo SqlTypeExceptionSerialization(SerializationInfo?si, StreamingContext sc)
 {
     if ((null != si) && (1 == si.MemberCount))
     {
         string?          message   = si.GetString("SqlTypeExceptionMessage");
         SqlTypeException fakeValue = new SqlTypeException(message);
         fakeValue.GetObjectData(si, sc);
     }
     return(si !);
 }
示例#8
0
        public static void SqlLocalDbException_GetObjectData_Throws_If_Info_Is_Null()
        {
            // Arrange
            var target = new SqlLocalDbException();

            SerializationInfo?info = null;
            var context            = new StreamingContext();

            // Act and Assert
            Assert.Throws <ArgumentNullException>("info", () => target.GetObjectData(info !, context));
        }
示例#9
0
 internal ReadObjectInfo CreateObjectInfo(ref SerializationInfo?si, ref object?[]?memberData)
 {
     if (_isInitObjectInfo)
     {
         _isInitObjectInfo = false;
         _objectInfo.InitDataStore(ref si, ref memberData);
         return(_objectInfo);
     }
     else
     {
         _objectInfo.PrepareForReuse();
         _objectInfo.InitDataStore(ref si, ref memberData);
         return(_objectInfo);
     }
 }
示例#10
0
        // Write Constructor used for array types or null members
        internal void InitSerialize(
            [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType,
            ISurrogateSelector?surrogateSelector,
            StreamingContext context,
            SerObjectInfoInit serObjectInfoInit,
            IFormatterConverter converter,
            SerializationBinder?binder)
        {
            _objectType        = objectType;
            _context           = context;
            _serObjectInfoInit = serObjectInfoInit;

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

            InvokeSerializationBinder(binder);

            if (surrogateSelector != null)
            {
                _serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out ISurrogateSelector 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 (!ReferenceEquals(objectType, Converter.s_typeofObject) && Converter.s_typeofISerializable.IsAssignableFrom(objectType))
            {
                _si    = new SerializationInfo(objectType, converter);
                _cache = new SerObjectInfoCache(objectType);
                CheckTypeForwardedFrom(_cache, objectType, _binderAssemblyString);
                _isSi = true;
            }

            if (!_isSi)
            {
                InitMemberInfo();
                CheckTypeForwardedFrom(_cache, objectType, _binderAssemblyString);
            }
        }
示例#11
0
        // Write constructor
        internal void InitSerialize(object obj, ISurrogateSelector?surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder?binder)
        {
            _context           = context;
            _obj               = obj;
            _serObjectInfoInit = serObjectInfoInit;
            _objectType        = obj.GetType();

            if (_objectType.IsArray)
            {
                _isArray = true;
                InitNoMembers();
                return;
            }

            InvokeSerializationBinder(binder);
            objectWriter.ObjectManager.RegisterObject(obj);

            ISurrogateSelector surrogateSelectorTemp;

            if (surrogateSelector != null && (_serializationSurrogate = surrogateSelector.GetSurrogate(_objectType, context, out surrogateSelectorTemp)) != null)
            {
                _si = new SerializationInfo(_objectType, converter);
                if (!_objectType.IsPrimitive)
                {
                    _serializationSurrogate.GetObjectData(obj, _si, context);
                }
                InitSiWrite();
            }
            else if (obj is ISerializable)
            {
                if (!_objectType.IsSerializable)
                {
                    throw new SerializationException(SR.Format(SR.Serialization_NonSerType, _objectType.FullName, _objectType.Assembly.FullName));
                }
                _si = new SerializationInfo(_objectType, converter);
                ((ISerializable)obj).GetObjectData(_si, context);
                InitSiWrite();
                CheckTypeForwardedFrom(_cache, _objectType, _binderAssemblyString);
            }
            else
            {
                InitMemberInfo();
                CheckTypeForwardedFrom(_cache, _objectType, _binderAssemblyString);
            }
        }
示例#12
0
        private void InternalInit()
        {
            _obj        = null;
            _objectType = null;
            _isSi       = false;
            _isNamed    = false;
            _isArray    = false;
            _si         = null;
            _cache      = null !;
            _memberData = null;

            // Writing and Parsing information
            _objectId = 0;
            _assemId  = 0;

            // Binder information
            _binderTypeName       = null;
            _binderAssemblyString = null;
        }
示例#13
0
        private void RegisterObject(object?obj, ParseRecord pr, ParseRecord?objectPr, bool bIsString)
        {
            if (!pr._isRegistered)
            {
                pr._isRegistered = true;

                SerializationInfo?si  = null;
                long       parentId   = 0;
                MemberInfo?memberInfo = null;
                int[]? indexMap = null;

                if (objectPr != null)
                {
                    indexMap = objectPr._indexMap;
                    parentId = objectPr._objectId;

                    if (objectPr._objectInfo != null)
                    {
                        if (!objectPr._objectInfo._isSi)
                        {
                            // ParentId is only used if there is a memberInfo
                            memberInfo = objectPr._objectInfo.GetMemberInfo(pr._name);
                        }
                    }
                }
                // SerializationInfo is always needed for ISerialization
                si = pr._si;

                Debug.Assert(_objectManager != null);
                if (bIsString)
                {
                    _objectManager.RegisterString((string?)obj, pr._objectId, si, parentId, memberInfo);
                }
                else
                {
                    Debug.Assert(obj != null);
                    _objectManager.RegisterObject(obj, pr._objectId, si, parentId, memberInfo, indexMap);
                }
            }
        }
 protected MasterDataHttpClientException(SerializationInfo?info, StreamingContext context)
     : base(info, context)
 {
 }
 protected PlayerNotExistsException(SerializationInfo?info, StreamingContext context) : base(info, context)
 {
 }
 protected GuardException(SerializationInfo?info, StreamingContext context)
     : base(info, context)
 {
 }
示例#17
0
 protected MasterDataBusinessLogicGetDimensionStructuresByIdsAsyncOperationException(
     SerializationInfo?info,
     StreamingContext context)
     : base(info, context)
 {
 }
 protected MasterDataBusinessLogicCountSourceFormatsAsync(
     SerializationInfo?info,
     StreamingContext context)
     : base(info, context)
 {
 }
示例#19
0
 protected MenuControllerNullInputException(SerializationInfo?info, StreamingContext context)
     : base(info, context)
 {
 }
示例#20
0
文件: Error.cs 项目: ysdxz207/csjvm
 protected Error(SerializationInfo?info, StreamingContext context) : base(info, context)
 {
 }
示例#21
0
 protected ModuleControllerArgumentNullException(SerializationInfo?info, StreamingContext context)
     : base(info, context)
 {
 }
示例#22
0
 protected WrongAgeException(SerializationInfo?info, StreamingContext context) : base(info, context)
 {
 }
示例#23
0
 protected LinkedList(SerializationInfo info, StreamingContext context)
 {
     _siInfo = info;
 }
示例#24
0
        private void WriteISerializable(TextWriter writer, ISerializable serializable)
        {
            SerializationInfo?info = serializable.GetSerializationInfo();

            WriteIDictionary(writer, info.GetPersistentData());
        }
示例#25
0
 protected IllegalArgumentException(SerializationInfo?info, StreamingContext context) : base(info, context)
 {
 }
 protected DiLibHttpClientErrorDetailsException(SerializationInfo?info, StreamingContext context)
     : base(
         info,
         context)
 {
 }
示例#27
0
 protected RazorEngineCompilationException(SerializationInfo?info, StreamingContext context) : base(info, context)
 {
 }
 protected MasterDataBusinessLogicDatabaseOperationException(SerializationInfo?info, StreamingContext context)
     : base(info, context)
 {
 }