private void ParseObject(ParseRecord pr)
{
if (!_fullDeserialization)
{
InitFullDeserialization();
}
if (pr._objectPositionEnum == InternalObjectPositionE.Top)
{
_topId = pr._objectId;
}
if (pr._parseTypeEnum == InternalParseTypeE.Object)
{
_stack.Push(pr); // Nested objects member names are already on stack
}
if (pr._objectTypeEnum == InternalObjectTypeE.Array)
{
ParseArray(pr);
return;
}
// If the Type is null, this means we have a typeload issue
// mark the object with TypeLoadExceptionHolder
if (pr._dtType == null)
{
pr._newObj = new TypeLoadExceptionHolder(pr._keyDt);
return;
}
if (ReferenceEquals(pr._dtType, Converter.s_typeofString))
{
// String as a top level object
if (pr._value != null)
{
pr._newObj = pr._value;
if (pr._objectPositionEnum == InternalObjectPositionE.Top)
{
TopObject = pr._newObj;
return;
}
else
{
_stack.Pop();
RegisterObject(pr._newObj, pr, (ParseRecord)_stack.Peek());
return;
}
}
else
{
// xml Doesn't have the value until later
return;
}
}
else
{
CheckSerializable(pr._dtType);
pr._newObj = FormatterServices.GetUninitializedObject(pr._dtType);
// Run the OnDeserializing methods
_objectManager.RaiseOnDeserializingEvent(pr._newObj);
}
if (pr._newObj == null)
{
throw new SerializationException(SR.Format(SR.Serialization_TopObjectInstantiate, pr._dtType));
}
if (pr._objectPositionEnum == InternalObjectPositionE.Top)
{
TopObject = pr._newObj;
}
if (pr._objectInfo == null)
{
pr._objectInfo = ReadObjectInfo.Create(pr._dtType, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly);
}
}