internal override object InternalReadObject(XmlReaderDelegator xmlReader, bool verifyObjectName) { if (MaxItemsInObjectGraph == 0) { throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.ExceededMaxItemsQuota, MaxItemsInObjectGraph)); } if (verifyObjectName) { if (!InternalIsStartObject(xmlReader)) { throw XmlObjectSerializer.CreateSerializationExceptionWithReaderDetails(SR.Format(SR.ExpectingElement, XmlDictionaryString.Empty, RootName), xmlReader); } } else if (!IsStartElement(xmlReader)) { throw XmlObjectSerializer.CreateSerializationExceptionWithReaderDetails(SR.Format(SR.ExpectingElementAtDeserialize, XmlNodeType.Element), xmlReader); } DataContract contract = RootContract; if (contract.IsPrimitive && object.ReferenceEquals(contract.UnderlyingType, _rootType))// handle Nullable<T> differently { return(DataContractJsonSerializerImpl.ReadJsonValue(contract, xmlReader, null)); } XmlObjectSerializerReadContextComplexJson context = XmlObjectSerializerReadContextComplexJson.CreateContext(this, contract); return(context.InternalDeserialize(xmlReader, _rootType, contract, null, null)); }
object InternalDeserialize(Type type, string name) { Type declaredType = type.IsPointer ? Globals.TypeOfReflectionPointer : type; var obj = context.InternalDeserialize(xmlReader, DataContract.GetId(declaredType.TypeHandle), declaredType.TypeHandle, name, string.Empty); if (type.IsPointer) { // wow, there is no way to convert void* to object in strongly typed way... return(JsonFormatGeneratorStatics.UnboxPointer.Invoke(null, new object [] { obj })); } else { return(CodeInterpreter.ConvertValue(obj, Globals.TypeOfObject, type)); } }