private bool GetCompletionInfo(FixupHolder fixup, out ObjectHolder holder, out object member, bool bThrowIfMissing) { member = fixup.m_fixupInfo; holder = this.FindObjectHolder(fixup.m_id); if ((!holder.CompletelyFixed && (holder.ObjectValue != null)) && (holder.ObjectValue is ValueType)) { this.SpecialFixupObjects.Add(holder); return(false); } if (((holder != null) && !holder.CanObjectValueChange) && (holder.ObjectValue != null)) { return(true); } if (!bThrowIfMissing) { return(false); } if (holder == null) { throw new SerializationException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Serialization_NeverSeen"), new object[] { fixup.m_id })); } if (holder.IsIncompleteObjectReference) { throw new SerializationException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Serialization_IORIncomplete"), new object[] { fixup.m_id })); } throw new SerializationException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Serialization_ObjectNotSupplied"), new object[] { fixup.m_id })); }
internal virtual void Add(FixupHolder fixup) { if (this.m_count == this.m_values.Length) { this.EnlargeArray(); } this.m_values[this.m_count++] = fixup; }
private void RegisterFixup(FixupHolder fixup, long objectToBeFixed, long objectRequired) { ObjectHolder holder = this.FindOrCreateObjectHolder(objectToBeFixed); if (holder.RequiresSerInfoFixup && (fixup.m_fixupType == 2)) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFixupType")); } holder.AddFixup(fixup, this); this.FindOrCreateObjectHolder(objectRequired).AddDependency(objectToBeFixed); this.m_fixupCount += 1L; }
// Token: 0x06005196 RID: 20886 RVA: 0x0011E168 File Offset: 0x0011C368 internal virtual void Add(FixupHolder fixup) { if (this.m_count == this.m_values.Length) { this.EnlargeArray(); } FixupHolder[] values = this.m_values; int count = this.m_count; this.m_count = count + 1; values[count] = fixup; }
internal void AddFixup(FixupHolder fixup, ObjectManager manager) { if (this.m_missingElements == null) { this.m_missingElements = new FixupHolderList(); } this.m_missingElements.Add(fixup); this.m_missingElementsRemaining++; if (this.RequiresValueTypeFixup) { this.UpdateDescendentDependencyChain(1, manager); } }
/// <summary>Records a fixup for an object member, to be executed later.</summary> /// <param name="objectToBeFixed">The ID of the object that needs the reference to <paramref name="objectRequired" />. </param> /// <param name="memberName">The member name of <paramref name="objectToBeFixed" /> where the fixup will be performed. </param> /// <param name="objectRequired">The ID of the object required by <paramref name="objectToBeFixed" />. </param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="objectToBeFixed" /> or <paramref name="objectRequired" /> parameter is less than or equal to zero. </exception> /// <exception cref="T:System.ArgumentNullException">The <paramref name="memberName" /> parameter is <see langword="null" />. </exception> // Token: 0x06005160 RID: 20832 RVA: 0x0011D9C0 File Offset: 0x0011BBC0 public virtual void RecordDelayedFixup(long objectToBeFixed, string memberName, long objectRequired) { if (objectToBeFixed <= 0L || objectRequired <= 0L) { throw new ArgumentOutOfRangeException((objectToBeFixed <= 0L) ? "objectToBeFixed" : "objectRequired", Environment.GetResourceString("Serialization_IdTooSmall")); } if (memberName == null) { throw new ArgumentNullException("memberName"); } FixupHolder fixup = new FixupHolder(objectRequired, memberName, 4); this.RegisterFixup(fixup, objectToBeFixed, objectRequired); }
/// <summary>Records fixups for the specified elements in an array, to be executed later.</summary> /// <param name="arrayToBeFixed">The ID of the array used to record a fixup. </param> /// <param name="indices">The indexes within the multidimensional array that a fixup is requested for. </param> /// <param name="objectRequired">The ID of the object the array elements will point to after fixup is completed. </param> /// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="arrayToBeFixed" /> or <paramref name="objectRequired" /> parameter is less than or equal to zero. </exception> /// <exception cref="T:System.ArgumentNullException">The <paramref name="indices" /> parameter is <see langword="null" />. </exception> // Token: 0x06005162 RID: 20834 RVA: 0x0011DA3C File Offset: 0x0011BC3C public virtual void RecordArrayElementFixup(long arrayToBeFixed, int[] indices, long objectRequired) { if (arrayToBeFixed <= 0L || objectRequired <= 0L) { throw new ArgumentOutOfRangeException((arrayToBeFixed <= 0L) ? "objectToBeFixed" : "objectRequired", Environment.GetResourceString("Serialization_IdTooSmall")); } if (indices == null) { throw new ArgumentNullException("indices"); } FixupHolder fixup = new FixupHolder(objectRequired, indices, 1); this.RegisterFixup(fixup, arrayToBeFixed, objectRequired); }
private void EnlargeArray() { int num = this.m_values.Length * 2; if (num < 0) { if (num == 0x7fffffff) { throw new SerializationException(Environment.GetResourceString("Serialization_TooManyElements")); } num = 0x7fffffff; } FixupHolder[] destinationArray = new FixupHolder[num]; Array.Copy(this.m_values, destinationArray, this.m_count); this.m_values = destinationArray; }
// Token: 0x06005197 RID: 20887 RVA: 0x0011E1A4 File Offset: 0x0011C3A4 private void EnlargeArray() { int num = this.m_values.Length * 2; if (num < 0) { if (num == 2147483647) { throw new SerializationException(Environment.GetResourceString("Serialization_TooManyElements")); } num = int.MaxValue; } FixupHolder[] array = new FixupHolder[num]; Array.Copy(this.m_values, array, this.m_count); this.m_values = array; }
public virtual void RecordFixup(long objectToBeFixed, MemberInfo member, long objectRequired) { if ((objectToBeFixed <= 0L) || (objectRequired <= 0L)) { throw new ArgumentOutOfRangeException((objectToBeFixed <= 0L) ? "objectToBeFixed" : "objectRequired", Environment.GetResourceString("Serialization_IdTooSmall")); } if (member == null) { throw new ArgumentNullException("member"); } if (!(member is RuntimeFieldInfo) && !(member is SerializationFieldInfo)) { throw new SerializationException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Serialization_InvalidType"), new object[] { member.GetType().ToString() })); } FixupHolder fixup = new FixupHolder(objectRequired, member, 2); this.RegisterFixup(fixup, objectToBeFixed, objectRequired); }
private bool GetCompletionInfo(FixupHolder fixup, out ObjectHolder holder, out object member, bool bThrowIfMissing) { member = fixup.m_fixupInfo; holder = this.FindObjectHolder(fixup.m_id); if ((!holder.CompletelyFixed && (holder.ObjectValue != null)) && (holder.ObjectValue is ValueType)) { this.SpecialFixupObjects.Add(holder); return false; } if (((holder != null) && !holder.CanObjectValueChange) && (holder.ObjectValue != null)) { return true; } if (!bThrowIfMissing) { return false; } if (holder == null) { throw new SerializationException(Environment.GetResourceString("Serialization_NeverSeen", new object[] { fixup.m_id })); } if (holder.IsIncompleteObjectReference) { throw new SerializationException(Environment.GetResourceString("Serialization_IORIncomplete", new object[] { fixup.m_id })); } throw new SerializationException(Environment.GetResourceString("Serialization_ObjectNotSupplied", new object[] { fixup.m_id })); }
public virtual void RecordArrayElementFixup(long arrayToBeFixed, int[] indices, long objectRequired) { if ((arrayToBeFixed <= 0L) || (objectRequired <= 0L)) { throw new ArgumentOutOfRangeException((arrayToBeFixed <= 0L) ? "objectToBeFixed" : "objectRequired", Environment.GetResourceString("Serialization_IdTooSmall")); } if (indices == null) { throw new ArgumentNullException("indices"); } FixupHolder fixup = new FixupHolder(objectRequired, indices, 1); this.RegisterFixup(fixup, arrayToBeFixed, objectRequired); }
internal void CompleteObject(ObjectHolder holder, bool bObjectFullyComplete) { FixupHolderList missingElements = holder.m_missingElements; object obj = null; ObjectHolder objectHolder = null; int num = 0; if (holder.ObjectValue == null) { throw new SerializationException(Environment.GetResourceString("Serialization_MissingObject", new object[] { holder.m_id })); } if (missingElements == null) { return; } if (holder.HasSurrogate || holder.HasISerializable) { SerializationInfo serInfo = holder.m_serInfo; if (serInfo == null) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFixupDiscovered")); } if (missingElements != null) { for (int i = 0; i < missingElements.m_count; i++) { if (missingElements.m_values[i] != null && this.GetCompletionInfo(missingElements.m_values[i], out objectHolder, out obj, bObjectFullyComplete)) { object objectValue = objectHolder.ObjectValue; if (this.CanCallGetType(objectValue)) { serInfo.UpdateValue((string)obj, objectValue, objectValue.GetType()); } else { serInfo.UpdateValue((string)obj, objectValue, typeof(MarshalByRefObject)); } num++; missingElements.m_values[i] = null; if (!bObjectFullyComplete) { holder.DecrementFixupsRemaining(this); objectHolder.RemoveDependency(holder.m_id); } } } } } else { for (int j = 0; j < missingElements.m_count; j++) { FixupHolder fixupHolder = missingElements.m_values[j]; if (fixupHolder != null && this.GetCompletionInfo(fixupHolder, out objectHolder, out obj, bObjectFullyComplete)) { if (objectHolder.TypeLoadExceptionReachable) { holder.TypeLoadException = objectHolder.TypeLoadException; if (holder.Reachable) { throw new SerializationException(Environment.GetResourceString("Serialization_TypeLoadFailure", new object[] { holder.TypeLoadException.TypeName })); } } if (holder.Reachable) { objectHolder.Reachable = true; } int fixupType = fixupHolder.m_fixupType; if (fixupType != 1) { if (fixupType != 2) { throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } MemberInfo memberInfo = (MemberInfo)obj; if (memberInfo.MemberType != MemberTypes.Field) { throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } if (holder.RequiresValueTypeFixup && holder.ValueTypeFixupPerformed) { if (!this.DoValueTypeFixup((FieldInfo)memberInfo, holder, objectHolder.ObjectValue)) { throw new SerializationException(Environment.GetResourceString("Serialization_PartialValueTypeFixup")); } } else { FormatterServices.SerializationSetValue(memberInfo, holder.ObjectValue, objectHolder.ObjectValue); } if (objectHolder.RequiresValueTypeFixup) { objectHolder.ValueTypeFixupPerformed = true; } } else { if (holder.RequiresValueTypeFixup) { throw new SerializationException(Environment.GetResourceString("Serialization_ValueTypeFixup")); } ((Array)holder.ObjectValue).SetValue(objectHolder.ObjectValue, (int[])obj); } num++; missingElements.m_values[j] = null; if (!bObjectFullyComplete) { holder.DecrementFixupsRemaining(this); objectHolder.RemoveDependency(holder.m_id); } } } } this.m_fixupCount -= (long)num; if (missingElements.m_count == num) { holder.m_missingElements = null; } }
public virtual void RecordDelayedFixup(long objectToBeFixed, string memberName, long objectRequired) { if ((objectToBeFixed <= 0L) || (objectRequired <= 0L)) { throw new ArgumentOutOfRangeException((objectToBeFixed <= 0L) ? "objectToBeFixed" : "objectRequired", Environment.GetResourceString("Serialization_IdTooSmall")); } if (memberName == null) { throw new ArgumentNullException("memberName"); } FixupHolder fixup = new FixupHolder(objectRequired, memberName, 4); this.RegisterFixup(fixup, objectToBeFixed, objectRequired); }
public virtual void RecordArrayElementFixup(long arrayToBeFixed, int[] indices, long objectRequired) { //Verify our arguments if (arrayToBeFixed <= 0 || objectRequired <= 0) { throw new ArgumentOutOfRangeException(arrayToBeFixed <= 0 ? nameof(arrayToBeFixed) : nameof(objectRequired), SR.Serialization_IdTooSmall); } if (indices == null) { throw new ArgumentNullException(nameof(indices)); } FixupHolder fixup = new FixupHolder(objectRequired, indices, FixupHolder.ArrayFixup); RegisterFixup(fixup, arrayToBeFixed, objectRequired); }
private void EnlargeArray() { int newLength = m_values.Length*2; if (newLength<0) { if (newLength==Int32.MaxValue) { throw new SerializationException(Environment.GetResourceString("Serialization_TooManyElements")); } newLength=Int32.MaxValue; } FixupHolder[] temp = new FixupHolder[newLength]; Array.Copy(m_values, temp, m_count); m_values=temp; }
private void EnlargeArray() { int newLength = _values.Length * 2; if (newLength < 0) { if (newLength == int.MaxValue) { throw new SerializationException(SR.Serialization_TooManyElements); } newLength = int.MaxValue; } FixupHolder[] temp = new FixupHolder[newLength]; Array.Copy(_values, 0, temp, 0, _count); _values = temp; }
/*==============================RecordDelayedFixup============================== **Action: **Returns: **Arguments: **Exceptions: ==============================================================================*/ /// <include file='doc\ObjectManager.uex' path='docs/doc[@for="ObjectManager.RecordDelayedFixup"]/*' /> public virtual void RecordDelayedFixup(long objectToBeFixed, String memberName, long objectRequired) { //Verify our arguments if (objectToBeFixed<=0 || objectRequired<=0) { throw new ArgumentOutOfRangeException(((objectToBeFixed<=0)?"objectToBeFixed":"objectRequired"), Environment.GetResourceString("Serialization_IdTooSmall")); } if (memberName==null) { throw new ArgumentNullException("memberName"); } BCLDebug.Trace("SER", "RecordDelayedFixup. ObjectToBeFixed: ", objectToBeFixed, "\tMember: ", memberName, "\tRequiredObject: ", objectRequired); //Create a new fixup holder FixupHolder fixup = new FixupHolder(objectRequired, memberName, FixupHolder.DelayedFixup); RegisterFixup(fixup, objectToBeFixed, objectRequired); }
/*================================RegisterFixup================================= **Action: Do the actual grunt work of recording a fixup and registering the dependency. ** Create the necessary ObjectHolders and use them to do the addition. **Returns: void **Arguments: fixup -- The FixupHolder to be added. ** objectToBeFixed -- The id of the object requiring the fixup. ** objectRequired -- The id of the object required to do the fixup. **Exceptions: None. This is internal-only, so all checking should have been done by this time. ==============================================================================*/ private void RegisterFixup(FixupHolder fixup, long objectToBeFixed, long objectRequired) { //Record the fixup with the object that needs it. ObjectHolder ohToBeFixed = FindOrCreateObjectHolder(objectToBeFixed); ObjectHolder ohRequired; if (ohToBeFixed.RequiresSerInfoFixup && fixup.m_fixupType == FixupHolder.MemberFixup) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFixupType")); } //Add the fixup to the list. ohToBeFixed.AddFixup(fixup, this); //Find the object on which we're dependent and note the dependency. //These dependencies will be processed when the object is supplied. ohRequired = FindOrCreateObjectHolder(objectRequired); ohRequired.AddDependency(objectToBeFixed); m_fixupCount++; }
internal void CompleteObject(ObjectHolder holder, bool bObjectFullyComplete) { FixupHolderList fixupHolderList = holder.m_missingElements; object member = (object)null; ObjectHolder holder1 = (ObjectHolder)null; int num = 0; if (holder.ObjectValue == null) { throw new SerializationException(Environment.GetResourceString("Serialization_MissingObject", (object)holder.m_id)); } if (fixupHolderList == null) { return; } if (holder.HasSurrogate || holder.HasISerializable) { SerializationInfo serializationInfo1 = holder.m_serInfo; if (serializationInfo1 == null) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFixupDiscovered")); } if (fixupHolderList != null) { for (int index = 0; index < fixupHolderList.m_count; ++index) { if (fixupHolderList.m_values[index] != null && this.GetCompletionInfo(fixupHolderList.m_values[index], out holder1, out member, bObjectFullyComplete)) { object objectValue = holder1.ObjectValue; if (this.CanCallGetType(objectValue)) { SerializationInfo serializationInfo2 = serializationInfo1; string name = (string)member; object obj = objectValue; Type type = obj.GetType(); serializationInfo2.UpdateValue(name, obj, type); } else { serializationInfo1.UpdateValue((string)member, objectValue, typeof(MarshalByRefObject)); } ++num; fixupHolderList.m_values[index] = (FixupHolder)null; if (!bObjectFullyComplete) { holder.DecrementFixupsRemaining(this); holder1.RemoveDependency(holder.m_id); } } } } } else { for (int index = 0; index < fixupHolderList.m_count; ++index) { FixupHolder fixup = fixupHolderList.m_values[index]; if (fixup != null && this.GetCompletionInfo(fixup, out holder1, out member, bObjectFullyComplete)) { if (holder1.TypeLoadExceptionReachable) { holder.TypeLoadException = holder1.TypeLoadException; if (holder.Reachable) { throw new SerializationException(Environment.GetResourceString("Serialization_TypeLoadFailure", (object)holder.TypeLoadException.TypeName)); } } if (holder.Reachable) { holder1.Reachable = true; } switch (fixup.m_fixupType) { case 1: if (holder.RequiresValueTypeFixup) { throw new SerializationException(Environment.GetResourceString("Serialization_ValueTypeFixup")); } ((Array)holder.ObjectValue).SetValue(holder1.ObjectValue, (int[])member); break; case 2: MemberInfo fi = (MemberInfo)member; if (fi.MemberType != MemberTypes.Field) { throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } if (holder.RequiresValueTypeFixup && holder.ValueTypeFixupPerformed) { if (!this.DoValueTypeFixup((FieldInfo)fi, holder, holder1.ObjectValue)) { throw new SerializationException(Environment.GetResourceString("Serialization_PartialValueTypeFixup")); } } else { FormatterServices.SerializationSetValue(fi, holder.ObjectValue, holder1.ObjectValue); } if (holder1.RequiresValueTypeFixup) { holder1.ValueTypeFixupPerformed = true; break; } break; default: throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } ++num; fixupHolderList.m_values[index] = (FixupHolder)null; if (!bObjectFullyComplete) { holder.DecrementFixupsRemaining(this); holder1.RemoveDependency(holder.m_id); } } } } this.m_fixupCount = this.m_fixupCount - (long)num; if (fixupHolderList.m_count != num) { return; } holder.m_missingElements = (FixupHolderList)null; }
internal void CompleteObject(ObjectHolder holder, bool bObjectFullyComplete) { FixupHolderList missingElements = holder.m_missingElements; object member = null; ObjectHolder holder3 = null; int num = 0; if (holder.ObjectValue == null) { throw new SerializationException(Environment.GetResourceString("Serialization_MissingObject", new object[] { holder.m_id })); } if (missingElements != null) { if (holder.HasSurrogate || holder.HasISerializable) { SerializationInfo serInfo = holder.m_serInfo; if (serInfo == null) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFixupDiscovered")); } if (missingElements != null) { for (int i = 0; i < missingElements.m_count; i++) { if ((missingElements.m_values[i] != null) && this.GetCompletionInfo(missingElements.m_values[i], out holder3, out member, bObjectFullyComplete)) { object objectValue = holder3.ObjectValue; if (this.CanCallGetType(objectValue)) { serInfo.UpdateValue((string)member, objectValue, objectValue.GetType()); } else { serInfo.UpdateValue((string)member, objectValue, typeof(MarshalByRefObject)); } num++; missingElements.m_values[i] = null; if (!bObjectFullyComplete) { holder.DecrementFixupsRemaining(this); holder3.RemoveDependency(holder.m_id); } } } } } else { for (int j = 0; j < missingElements.m_count; j++) { MemberInfo info2; FixupHolder fixup = missingElements.m_values[j]; if ((fixup == null) || !this.GetCompletionInfo(fixup, out holder3, out member, bObjectFullyComplete)) { continue; } if (holder3.TypeLoadExceptionReachable) { holder.TypeLoadException = holder3.TypeLoadException; if (holder.Reachable) { throw new SerializationException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Serialization_TypeLoadFailure"), new object[] { holder.TypeLoadException.TypeName })); } } if (holder.Reachable) { holder3.Reachable = true; } switch (fixup.m_fixupType) { case 1: if (holder.RequiresValueTypeFixup) { throw new SerializationException(Environment.GetResourceString("Serialization_ValueTypeFixup")); } break; case 2: info2 = (MemberInfo)member; if (info2.MemberType != MemberTypes.Field) { throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } if (!holder.RequiresValueTypeFixup || !holder.ValueTypeFixupPerformed) { goto Label_024C; } if (!this.DoValueTypeFixup((FieldInfo)info2, holder, holder3.ObjectValue)) { throw new SerializationException(Environment.GetResourceString("Serialization_PartialValueTypeFixup")); } goto Label_0260; default: throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } ((Array)holder.ObjectValue).SetValue(holder3.ObjectValue, (int[])member); goto Label_0293; Label_024C: FormatterServices.SerializationSetValue(info2, holder.ObjectValue, holder3.ObjectValue); Label_0260: if (holder3.RequiresValueTypeFixup) { holder3.ValueTypeFixupPerformed = true; } Label_0293: num++; missingElements.m_values[j] = null; if (!bObjectFullyComplete) { holder.DecrementFixupsRemaining(this); holder3.RemoveDependency(holder.m_id); } } } this.m_fixupCount -= num; if (missingElements.m_count == num) { holder.m_missingElements = null; } } }
/*===================================AddFixup=================================== **Action: Note a fixup that has to be done before this object can be completed. ** Fixups are things that need to happen when other objects in the graph ** are added. Dependencies are things that need to happen when this object ** is added. **Returns: void **Arguments: fixup -- The fixup holder containing enough information to complete the fixup. **Exceptions: None. ==============================================================================*/ internal virtual void AddFixup(FixupHolder fixup, ObjectManager manager) { if (m_missingElements==null) { m_missingElements = new FixupHolderList(); } m_missingElements.Add(fixup); m_missingElementsRemaining++; if (RequiresValueTypeFixup) { UpdateDescendentDependencyChain(1, manager); } }
public virtual void RecordFixup(long objectToBeFixed, MemberInfo member, long objectRequired) { //Verify our arguments if (objectToBeFixed <= 0 || objectRequired <= 0) { throw new ArgumentOutOfRangeException(objectToBeFixed <= 0 ? nameof(objectToBeFixed) : nameof(objectRequired), SR.Serialization_IdTooSmall); } if (member == null) { throw new ArgumentNullException(nameof(member)); } if (!(member is FieldInfo)) { throw new SerializationException(SR.Format(SR.Serialization_InvalidType, member.GetType().ToString())); } //Create a new fixup holder FixupHolder fixup = new FixupHolder(objectRequired, member, FixupHolder.MemberFixup); RegisterFixup(fixup, objectToBeFixed, objectRequired); }
internal virtual void Add(FixupHolder fixup) { if (m_count==m_values.Length) { EnlargeArray(); } m_values[m_count++]=fixup; }
public virtual void RecordDelayedFixup(long objectToBeFixed, string memberName, long objectRequired) { //Verify our arguments if (objectToBeFixed <= 0 || objectRequired <= 0) { throw new ArgumentOutOfRangeException(objectToBeFixed <= 0 ? nameof(objectToBeFixed) : nameof(objectRequired), SR.Serialization_IdTooSmall); } if (memberName == null) { throw new ArgumentNullException(nameof(memberName)); } //Create a new fixup holder FixupHolder fixup = new FixupHolder(objectRequired, memberName, FixupHolder.DelayedFixup); RegisterFixup(fixup, objectToBeFixed, objectRequired); }
private bool GetCompletionInfo(FixupHolder fixup, out ObjectHolder holder, out Object member, bool bThrowIfMissing) { //Set the member id (String or MemberInfo) for the member being fixed up. member = fixup.m_fixupInfo; //Find the object required for the fixup. Throw if we can't find it. holder = FindObjectHolder(fixup.m_id); BCLDebug.Trace("SER", "[ObjectManager.GetCompletionInfo]Getting fixup info for: ", fixup.m_id); // CompletelyFixed is our poorly named property which indicates if something requires a SerializationInfo fixup // or is an incomplete object reference. We have this particular branch to handle valuetypes which implement // ISerializable. In that case, we can't do any fixups on them later, so we need to delay the fixups further. if (!holder.CompletelyFixed) { if (holder.ObjectValue!=null && holder.ObjectValue is ValueType) { BCLDebug.Trace("SER", "[ObjectManager.GetCompletionInfo]ValueType implementing ISerializable. Delaying fixup."); SpecialFixupObjects.Add(holder); return false; } } if (holder==null || holder.IsIncompleteObjectReference || holder.ObjectValue==null) { if (bThrowIfMissing) { BCLDebug.Trace("SER", "[GetCompletionInfo]Unable to find fixup for: ", fixup.m_id); BCLDebug.Trace("SER", "[GetCompletionInfo]Holder: ", ((holder==null)?"<null>":"Non Null")); BCLDebug.Trace("SER", "[GetCompletionInfo]IsIncomplete: ", (holder.IsIncompleteObjectReference)); BCLDebug.Trace("SER", "[GetCompletionInfo]Object: ", ((holder.ObjectValue==null)?"<null>":"Non Null")); if (holder==null) { throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_NeverSeen"), fixup.m_id)); } if (holder.IsIncompleteObjectReference) { throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_IORIncomplete"), fixup.m_id)); } throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_ObjectNotSupplied"), fixup.m_id)); } return false; } return true; }
public virtual void RecordFixup(long objectToBeFixed, MemberInfo member, long objectRequired) { if ((objectToBeFixed <= 0L) || (objectRequired <= 0L)) { throw new ArgumentOutOfRangeException((objectToBeFixed <= 0L) ? "objectToBeFixed" : "objectRequired", Environment.GetResourceString("Serialization_IdTooSmall")); } if (member == null) { throw new ArgumentNullException("member"); } if (!(member is RuntimeFieldInfo) && !(member is SerializationFieldInfo)) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", new object[] { member.GetType().ToString() })); } FixupHolder fixup = new FixupHolder(objectRequired, member, 2); this.RegisterFixup(fixup, objectToBeFixed, objectRequired); }
/// <include file='doc\ObjectManager.uex' path='docs/doc[@for="ObjectManager.RecordFixup"]/*' /> public virtual void RecordFixup(long objectToBeFixed, MemberInfo member, long objectRequired) { //Verify our arguments if (objectToBeFixed<=0 || objectRequired<=0) { throw new ArgumentOutOfRangeException(((objectToBeFixed<=0)?"objectToBeFixed":"objectRequired"), Environment.GetResourceString("Serialization_IdTooSmall")); } if (member==null) { throw new ArgumentNullException("member"); } if (!(member is RuntimeFieldInfo) && !(member is SerializationFieldInfo)) { throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_InvalidType"), member.GetType().ToString())); } BCLDebug.Trace("SER", "RecordFixup. ObjectToBeFixed: ", objectToBeFixed, "\tMember: ", member.Name, "\tRequiredObject: ", objectRequired); //Create a new fixup holder FixupHolder fixup = new FixupHolder(objectRequired, member, FixupHolder.MemberFixup); RegisterFixup(fixup, objectToBeFixed, objectRequired); }
private bool GetCompletionInfo(FixupHolder fixup, out ObjectHolder holder, out object member, bool bThrowIfMissing) { //Set the member id (String or MemberInfo) for the member being fixed up. member = fixup._fixupInfo; //Find the object required for the fixup. Throw if we can't find it. holder = FindObjectHolder(fixup._id); // CompletelyFixed is our poorly named property which indicates if something requires a SerializationInfo fixup // or is an incomplete object reference. We have this particular branch to handle valuetypes which implement // ISerializable. In that case, we can't do any fixups on them later, so we need to delay the fixups further. if (!holder.CompletelyFixed) { if (holder.ObjectValue != null && holder.ObjectValue is ValueType) { SpecialFixupObjects.Add(holder); return false; } } if (holder == null || holder.CanObjectValueChange || holder.ObjectValue == null) { if (bThrowIfMissing) { if (holder == null) { throw new SerializationException(SR.Format(SR.Serialization_NeverSeen, fixup._id)); } if (holder.IsIncompleteObjectReference) { throw new SerializationException(SR.Format(SR.Serialization_IORIncomplete, fixup._id)); } throw new SerializationException(SR.Format(SR.Serialization_ObjectNotSupplied, fixup._id)); } return false; } return true; }
/// <include file='doc\ObjectManager.uex' path='docs/doc[@for="ObjectManager.RecordArrayElementFixup1"]/*' /> public virtual void RecordArrayElementFixup(long arrayToBeFixed, int[] indices, long objectRequired) { //Verify our arguments if (arrayToBeFixed<=0 || objectRequired<=0) { throw new ArgumentOutOfRangeException(((arrayToBeFixed<=0)?"objectToBeFixed":"objectRequired"), Environment.GetResourceString("Serialization_IdTooSmall")); } if (indices==null) { throw new ArgumentNullException("indices"); } FixupHolder fixup = new FixupHolder(objectRequired, indices, FixupHolder.ArrayFixup); RegisterFixup(fixup, arrayToBeFixed, objectRequired); }
internal void Add(FixupHolder fixup) { if (_count == _values.Length) { EnlargeArray(); } _values[_count++] = fixup; }