protected virtual object Deserialize(XmlSerializationReader reader) { if (customSerializer) { // Must be implemented in derived class throw new NotImplementedException(); } try { if (reader is XmlSerializationReaderInterpreter) { return(((XmlSerializationReaderInterpreter)reader).ReadRoot()); } else { try { return(serializerData.ReaderMethod.Invoke(reader, null)); } catch (TargetInvocationException ex) { throw ex.InnerException; } } } catch (Exception ex) { if (ex is InvalidOperationException || ex is InvalidCastException) { throw new InvalidOperationException("There is an error in" + " XML document.", ex); } throw; } }
internal object InvokeReader(XmlMapping mapping, XmlReader xmlReader, XmlDeserializationEvents events, string encodingStyle) { XmlSerializationReader reader = null; try { encodingStyle = ValidateEncodingStyle(encodingStyle, mapping.Key); reader = Contract.Reader; reader.Init(xmlReader, events, encodingStyle, this); if (methods[mapping.Key].readMethod == null) { if (readerMethods == null) { readerMethods = Contract.ReadMethods; } string methodName = (string)readerMethods[mapping.Key]; if (methodName == null) { throw new InvalidOperationException(Res.GetString(Res.XmlNotSerializable, mapping.Accessor.Name)); } methods[mapping.Key].readMethod = GetMethodFromType(reader.GetType(), methodName, pregeneratedAssmbly ? this.assembly : null); } return(methods[mapping.Key].readMethod.Invoke(reader, emptyObjectArray)); } catch (SecurityException e) { throw new InvalidOperationException(Res.GetString(Res.XmlNoPartialTrust), e); } finally { if (reader != null) { reader.Dispose(); } } }
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize5"]/*' /> public object Deserialize(XmlReader xmlReader, string encodingStyle, XmlDeserializationEvents events) { events.sender = this; try { if (primitiveType != null) { if (encodingStyle != null && encodingStyle.Length > 0) { throw new InvalidOperationException(Res.GetString(Res.XmlInvalidEncodingNotEncoded1, encodingStyle)); } return(DeserializePrimitive(xmlReader, events)); } else if (tempAssembly == null || typedSerializer) { XmlSerializationReader reader = CreateReader(); reader.Init(xmlReader, events, encodingStyle, tempAssembly); try { return(Deserialize(reader)); } finally { reader.Dispose(); } } else { return(tempAssembly.InvokeReader(mapping, xmlReader, events, encodingStyle)); } } catch (Exception e) { if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) { throw; } if (e is TargetInvocationException) { e = e.InnerException; } if (xmlReader is IXmlLineInfo) { IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader; throw new InvalidOperationException(Res.GetString(Res.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), e); } else { throw new InvalidOperationException(Res.GetString(Res.XmlSerializeError), e); } } catch { if (xmlReader is IXmlLineInfo) { IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader; throw new InvalidOperationException(Res.GetString(Res.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), null); } else { throw new InvalidOperationException(Res.GetString(Res.XmlSerializeError), (Exception)null); } } }
/// <summary>Deserializes the XML document contained by the specified <see cref="T:System.Xml.Serialization.XmlSerializationReader" />.</summary> /// <returns>The deserialized object.</returns> /// <param name="reader">The <see cref="T:System.Xml.Serialization.XmlSerializationReader" /> that contains the XML document to deserialize. </param> /// <exception cref="T:System.NotImplementedException">Any attempt is made to access the method when the method is not overridden in a descendant class. </exception> protected virtual object Deserialize(XmlSerializationReader reader) { if (this.customSerializer) { throw new NotImplementedException(); } object result; try { if (reader is XmlSerializationReaderInterpreter) { result = ((XmlSerializationReaderInterpreter)reader).ReadRoot(); } else { result = this.serializerData.ReaderMethod.Invoke(reader, null); } } catch (Exception ex) { if (ex is InvalidOperationException || ex is InvalidCastException) { throw new InvalidOperationException("There is an error in XML document.", ex); } throw; } return(result); }
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize2"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public object Deserialize(XmlReader xmlReader) { try { if (tempAssembly == null) { XmlSerializationReader reader = CreateReader(); reader.Init(xmlReader, events); return(Deserialize(reader)); } return(tempAssembly.InvokeReader(methodIndex, xmlReader, events)); } catch (Exception e) { if (e is TargetInvocationException) { e = e.InnerException; } if (xmlReader is XmlTextReader) { XmlTextReader xmlTextReader = (XmlTextReader)xmlReader; throw new InvalidOperationException(Res.GetString(Res.XmlSerializeErrorDetails, xmlTextReader.LineNumber.ToString(), xmlTextReader.LinePosition.ToString()), e); } else { throw new InvalidOperationException(Res.GetString(Res.XmlSerializeError), e); } } }
internal object InvokeReader(XmlMapping mapping, XmlReader xmlReader, XmlDeserializationEvents events, string encodingStyle) { XmlSerializationReader reader = null; try { encodingStyle = ValidateEncodingStyle(encodingStyle, mapping.Key); reader = Contract.Reader; reader.Init(xmlReader, events, encodingStyle, this); if (_methods[mapping.Key].readMethod == null) { if (_readerMethods == null) { _readerMethods = Contract.ReadMethods; } string methodName = (string)_readerMethods[mapping.Key]; if (methodName == null) { throw new InvalidOperationException(SR.Format(SR.XmlNotSerializable, mapping.Accessor.Name)); } _methods[mapping.Key].readMethod = GetMethodFromType(reader.GetType(), methodName); } return _methods[mapping.Key].readMethod.Invoke(reader, Array.Empty<object>()); } catch (SecurityException e) { throw new InvalidOperationException(SR.XmlNoPartialTrust, e); } finally { if (reader != null) reader.Dispose(); } }
public object?Deserialize(XmlReader xmlReader, string?encodingStyle, XmlDeserializationEvents events) { events.sender = this; try { if (_primitiveType != null) { if (encodingStyle != null && encodingStyle.Length > 0) { throw new InvalidOperationException(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle)); } return(DeserializePrimitive(xmlReader, events)); } else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer) { return(DeserializeUsingReflection(xmlReader, encodingStyle, events)); } else if (_tempAssembly == null || _typedSerializer) { XmlSerializationReader reader = CreateReader(); reader.Init(xmlReader, events, encodingStyle, _tempAssembly); try { return(Deserialize(reader)); } finally { reader.Dispose(); } } else { return(_tempAssembly.InvokeReader(_mapping, xmlReader, events, encodingStyle)); } } catch (Exception?e) { if (e is TargetInvocationException) { e = e.InnerException; } if (xmlReader is IXmlLineInfo) { IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader; throw new InvalidOperationException(SR.Format(SR.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), e); } else { throw new InvalidOperationException(SR.XmlSerializeError, e); } } }
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize5"]/*' /> internal object Deserialize(XmlReader xmlReader, string encodingStyle, XmlDeserializationEvents events) { #if FEATURE_LEGACYNETCF if (_legacyNetCFSerializer != null) { return(_legacyNetCFSerializer.Deserialize(xmlReader, encodingStyle)); } #endif try { if (_primitiveType != null) { return(DeserializePrimitive(xmlReader, events)); } else if (_tempAssembly == null || _typedSerializer) { XmlSerializationReader reader = CreateReader(); reader.Init(xmlReader, events, encodingStyle, _tempAssembly); try { return(Deserialize(reader)); } finally { reader.Dispose(); } } else { return(_tempAssembly.InvokeReader(_mapping, xmlReader, events, encodingStyle)); } } catch (Exception e) { if (e is TargetInvocationException) { e = e.InnerException; } if (xmlReader is IXmlLineInfo) { IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader; throw new InvalidOperationException(SR.Format(SR.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), e); } else { throw new InvalidOperationException(SR.XmlSerializeError, e); } } }
internal object Read_dateTime() { base.Reader.MoveToContent(); if (base.Reader.NodeType == XmlNodeType.Element) { if ((base.Reader.LocalName != this.id10_dateTime) || (base.Reader.NamespaceURI != this.id2_Item)) { throw base.CreateUnknownNodeException(); } return(XmlSerializationReader.ToDateTime(base.Reader.ReadElementString())); } base.UnknownNode(null); return(null); }
public object Deserialize(XmlReader xmlReader, string encodingStyle, XmlDeserializationEvents events) { object obj2; events.sender = this; try { if (this.primitiveType != null) { if ((encodingStyle != null) && (encodingStyle.Length > 0)) { throw new InvalidOperationException(Res.GetString("XmlInvalidEncodingNotEncoded1", new object[] { encodingStyle })); } return(this.DeserializePrimitive(xmlReader, events)); } if ((this.tempAssembly == null) || this.typedSerializer) { XmlSerializationReader reader = this.CreateReader(); reader.Init(xmlReader, events, encodingStyle, this.tempAssembly); try { return(this.Deserialize(reader)); } finally { reader.Dispose(); } } obj2 = this.tempAssembly.InvokeReader(this.mapping, xmlReader, events, encodingStyle); } catch (Exception innerException) { if (((innerException is ThreadAbortException) || (innerException is StackOverflowException)) || (innerException is OutOfMemoryException)) { throw; } if (innerException is TargetInvocationException) { innerException = innerException.InnerException; } if (xmlReader is IXmlLineInfo) { IXmlLineInfo info = (IXmlLineInfo)xmlReader; throw new InvalidOperationException(Res.GetString("XmlSerializeErrorDetails", new object[] { info.LineNumber.ToString(CultureInfo.InvariantCulture), info.LinePosition.ToString(CultureInfo.InvariantCulture) }), innerException); } throw new InvalidOperationException(Res.GetString("XmlSerializeError"), innerException); } return(obj2); }
protected virtual object Deserialize(XmlSerializationReader reader) { if (customSerializer) { // Must be implemented in derived class throw new NotImplementedException(); } if (reader is XmlSerializationReaderInterpreter) { return(((XmlSerializationReaderInterpreter)reader).ReadRoot()); } else { return(serializerData.ReaderMethod.Invoke(reader, null)); } }
public object InvokeReader(int methodIndex, XmlReader xmlReader, XmlDeserializationEvents events) { if (!allAssembliesAllowPartialTrust) { new PermissionSet(PermissionState.Unrestricted).Demand(); } XmlSerializationReader reader = (XmlSerializationReader)Activator.CreateInstance(readerType); reader.Init(xmlReader, events); ResolveEventHandler resolver = new ResolveEventHandler(this.OnAssemblyResolve); assemblyResolveThread = Thread.CurrentThread.GetHashCode(); AppDomain.CurrentDomain.AssemblyResolve += resolver; object ret = methods[methodIndex].readMethod.Invoke(reader, emptyObjectArray); AppDomain.CurrentDomain.AssemblyResolve -= resolver; assemblyResolveThread = 0; return(ret); }
internal object InvokeReader(int methodIndex, XmlReader xmlReader, XmlDeserializationEvents events, string encodingStyle) { XmlSerializationReader reader = null; try { encodingStyle = ValidateEncodingStyle(encodingStyle, methodIndex); reader = (XmlSerializationReader)Activator.CreateInstance(readerType); reader.Init(xmlReader, events, encodingStyle, this); return(methods[methodIndex].readMethod.Invoke(reader, emptyObjectArray)); } catch (SecurityException e) { throw new InvalidOperationException(Res.GetString(Res.XmlNoPartialTrust), e); } finally { if (reader != null) { reader.Dispose(); } } }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read81_WildcardablePropertyQuery(); }
protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { return(((GeneratedReader)reader).ReadRoot_InventoryCollection()); }
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize4"]/*' /> ///<internalonly/> protected virtual object Deserialize(XmlSerializationReader reader) { throw new NotImplementedException(); }
protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { return(((WebReferenceOptionsReader)reader).ReadRoot_WebReferenceOptions()); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read336_FormPlacement(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read254_ContentDefaultParamStruct(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read213_ConfigurableSettingsProvider(); }
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize4"]/*' /> ///<internalonly/> protected virtual object Deserialize(XmlSerializationReader reader) { throw new PlatformNotSupportedException(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read317_VistaProgressBarRenderer(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read330_SolidSizeUnit(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read292_RatingTypeConverter(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read267_ItemDateTimePart(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read68_ConfirmImpact(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read242_PK_CAPS(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read237_ProcessItemEventArgs(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read307_DelayedExtractMode(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read258_AggregatedFilterCondition(); }
protected override object Deserialize (XmlSerializationReader reader) { ServiceDescriptionReaderBase xsReader = reader as ServiceDescriptionReaderBase; return xsReader.ReadRoot_ServiceDescription (); }
protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { return(base.Deserialize(reader)); }
protected virtual object Deserialize (XmlSerializationReader reader) { if (customSerializer) // Must be implemented in derived class throw new NotImplementedException (); try { if (reader is XmlSerializationReaderInterpreter) return ((XmlSerializationReaderInterpreter) reader).ReadRoot (); else { try { return serializerData.ReaderMethod.Invoke (reader, null); } catch (TargetInvocationException ex) { throw ex.InnerException; } } } catch (Exception ex) { if (ex is InvalidOperationException || ex is InvalidCastException) throw new InvalidOperationException ("There is an error in" + " XML document.", ex); throw; } }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read246_WcxErrors(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read314_SimpleEncrypt(); }
public object Deserialize(XmlSerializationReader reader) { throw new NotImplementedException(); }
///<internalonly/> protected virtual object Deserialize(XmlSerializationReader reader) { throw new PlatformNotSupportedException(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((DiscoveryDocumentSerializationReader)reader).Read10_discovery(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read223_CustomActionLink(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read315_ProgressRenderMode(); }
protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { return(((Soap12FaultReader)reader).ReadRoot_Soap12Fault()); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read74_StaticMethodParameterMetadata(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read278_HashPropertyProvider(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read361_CopyWorkerOptions(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read252_ShellFileSystemCreator(); }
protected override System.Object Deserialize(XmlSerializationReader reader) { return ((WebReferenceOptionsSerializationReader)reader).Read5_webReferenceOptions(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((ServiceDescriptionSerializationReader)reader).Read125_definitions(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read337_ArgumentKey(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read241_PK_OPERATION(); }
protected override object Deserialize(XmlSerializationReader reader) { return ((XmlSerializationReader1) reader).Read273_VirtualItemNameListFilter(); }