756 references to Globals
System.Private.DataContractSerialization (756)
System\Runtime\Serialization\Attributes.cs (2)
88Id = Globals.NewObjectId; 89Ref = Globals.NewObjectId;
System\Runtime\Serialization\BitFlagsGenerator.cs (1)
71LocalBuilder localArray = _ilg.DeclareLocal(Globals.TypeOfByteArray);
System\Runtime\Serialization\ClassDataContract.cs (35)
166if (ci == null || UnderlyingType == Globals.TypeOfSchemaDefinedType) 189Debug.Assert(UnderlyingType != Globals.TypeOfSchemaDefinedType); 219Debug.Assert(UnderlyingType != Globals.TypeOfSchemaDefinedType); 278if (!childType.IsEnum && !Globals.TypeOfIXmlSerializable.IsAssignableFrom(childType) 279&& DataContract.GetBuiltInDataContract(childType) == null && childType != Globals.TypeOfDBNull) 313if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type)) 319if (type.IsDefined(Globals.TypeOfCollectionDataContractAttribute, false)) 336if (Globals.TypeOfISerializable.IsAssignableFrom(type)) 339if (type.IsDefined(Globals.TypeOfDataContractAttribute, false)) 342if (type == Globals.TypeOfExtensionDataObject) 622if (type == Globals.TypeOfDBNull) 634IsISerializable = (Globals.TypeOfISerializable.IsAssignableFrom(type)); 641if (baseType != null && !(baseType.IsSerializable && Globals.TypeOfISerializable.IsAssignableFrom(baseType))) 646if (baseType != null && baseType != Globals.TypeOfObject && baseType != Globals.TypeOfValueType && baseType != Globals.TypeOfUri) 669_hasExtensionData = (Globals.TypeOfIExtensibleDataObject.IsAssignableFrom(type)); 913if (_hasExtensionData && memberContract.MemberType == Globals.TypeOfExtensionDataObject 914&& member.Name == Globals.ExtensionDataObjectPropertyName) 933object[] optionalFields = field!.GetCustomAttributes(Globals.TypeOfOptionalFieldAttribute, false); 1080if (method.Name == Globals.ExtensionDataSetExplicitMethod || !method.IsPublic) 1085if (IsValidCallback(method, parameters, Globals.TypeOfOnSerializingAttribute, _onSerializing, ref prevAttributeType)) 1087if (IsValidCallback(method, parameters, Globals.TypeOfOnSerializedAttribute, _onSerialized, ref prevAttributeType)) 1089if (IsValidCallback(method, parameters, Globals.TypeOfOnDeserializingAttribute, _onDeserializing, ref prevAttributeType)) 1091if (IsValidCallback(method, parameters, Globals.TypeOfOnDeserializedAttribute, _onDeserialized, ref prevAttributeType)) 1103if (method.Name == Globals.ExtensionDataSetExplicitMethod || method.Name == Globals.ExtensionDataSetMethod) 1109if (method.ReturnType != Globals.TypeOfVoid) 1111if (parameters == null || parameters.Length != 1 || parameters[0].ParameterType != Globals.TypeOfExtensionDataObject) 1112DataContract.ThrowInvalidDataContractException(SR.Format(SR.ExtensionDataSetParameterInvalid, DataContract.GetClrTypeFullName(method.DeclaringType), method, Globals.TypeOfExtensionDataObject), method.DeclaringType); 1132if (method.ReturnType != Globals.TypeOfVoid) 1134if (parameters == null || parameters.Length != 1 || parameters[0].ParameterType != Globals.TypeOfStreamingContext) 1135DataContract.ThrowInvalidDataContractException(SR.Format(SR.CallbackParameterInvalid, DataContract.GetClrTypeFullName(method.DeclaringType), method, Globals.TypeOfStreamingContext), method.DeclaringType); 1248ConstructorInfo? ctor = UnderlyingType.GetConstructor(Globals.ScanAllMembers, SerInfoCtorArgs); 1507type = Globals.TypeOfValueType;
System\Runtime\Serialization\CodeGenerator.cs (4)
323ConvertValue(type, Globals.TypeOfObject); 325ConvertValue(type, Globals.TypeOfObject); 546if (arrayType == Globals.TypeOfArray) 1307if (type != Globals.TypeOfString)
System\Runtime\Serialization\CollectionDataContract.cs (65)
432Globals.TypeOfIDictionaryGeneric, 433Globals.TypeOfIDictionary, 434Globals.TypeOfIListGeneric, 435Globals.TypeOfICollectionGeneric, 436Globals.TypeOfIList, 437Globals.TypeOfIEnumerableGeneric, 438Globals.TypeOfICollection, 439Globals.TypeOfIEnumerable 488_keyName = keyName ?? Globals.KeyLocalName; 489_valueName = valueName ?? Globals.ValueLocalName; 504if (type == Globals.TypeOfArray) 505type = Globals.TypeOfObjectArray; 533XmlName = CreateQualifiedName(Globals.ArrayPrefix + itemContract.XmlName.Name, itemContract.XmlName.Namespace); 798s_buildIncrementCollectionCountDelegateMethod ??= typeof(CollectionDataContractCriticalHelper).GetMethod(nameof(BuildIncrementCollectionCountDelegate), Globals.ScanAllMembers)!; 850enumeratorType = Globals.TypeOfGenericDictionaryEnumerator.MakeGenericType(keyValueTypes); 854enumeratorType = Globals.TypeOfDictionaryEnumerator; 861MethodInfo? getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes); 870Type ienumeratorInterface = Globals.TypeOfIEnumerator; 877&& interfaceType.GetGenericTypeDefinition() == Globals.TypeOfIEnumeratorGeneric 886getCurrentMethod = GetTargetMethodWithName(Globals.GetCurrentMethodName, enumeratorType, ienumeratorInterface)!; 897s_buildCreateGenericDictionaryEnumerator ??= typeof(CollectionDataContractCriticalHelper).GetMethod(nameof(BuildCreateGenericDictionaryEnumerator), Globals.ScanAllMembers)!; 912if (type.IsDefined(Globals.TypeOfCollectionDataContractAttribute, false)) 917if (type.IsSerializable || type.IsDefined(Globals.TypeOfDataContractAttribute, false)) 1010itemType = Globals.TypeOfObject; 1024bool isBaseTypeCollection = (baseType != null && baseType != Globals.TypeOfObject 1025&& baseType != Globals.TypeOfValueType && baseType != Globals.TypeOfUri) ? IsCollection(baseType) : false; 1032if (type.IsDefined(Globals.TypeOfDataContractAttribute, false)) 1038if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type) || IsArraySegment(type)) 1043if (!Globals.TypeOfIEnumerable.IsAssignableFrom(type)) 1061if (interfaceTypeToCheck == Globals.TypeOfIDictionaryGeneric) 1063itemType = Globals.TypeOfKeyValue.MakeGenericType(genericArgs); 1064addMethod = type.GetMethod(Globals.AddMethodName); 1065getEnumeratorMethod = Globals.TypeOfIEnumerableGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(genericArgs)).GetMethod(Globals.GetEnumeratorMethodName)!; 1070if (interfaceTypeToCheck == Globals.TypeOfICollectionGeneric || interfaceTypeToCheck == Globals.TypeOfIListGeneric) 1072addMethod = Globals.TypeOfICollectionGeneric.MakeGenericType(itemType).GetMethod(Globals.AddMethodName); 1074getEnumeratorMethod = Globals.TypeOfIEnumerableGeneric.MakeGenericType(itemType).GetMethod(Globals.GetEnumeratorMethodName)!; 1079if (interfaceTypeToCheck == Globals.TypeOfIDictionary) 1082addMethod = type.GetMethod(Globals.AddMethodName); 1086itemType = Globals.TypeOfObject; 1089if (interfaceTypeToCheck == Globals.TypeOfIList) 1091addMethod = type.GetMethod(Globals.AddMethodName); 1095getEnumeratorMethod = typeof(IEnumerable).GetMethod(Globals.GetEnumeratorMethodName)!; 1163knownInterfaceType = Globals.TypeOfIEnumerable; 1164itemType = knownInterfaceType.IsGenericType ? knownInterfaceType.GetGenericArguments()[0] : Globals.TypeOfObject; 1211itemType = isOpenGeneric ? Globals.TypeOfKeyValue : Globals.TypeOfKeyValue.MakeGenericType(addMethodTypeArray); 1214addMethodTypeArray = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject }; 1215itemType = Globals.TypeOfKeyValue.MakeGenericType(addMethodTypeArray); 1223itemType = Globals.TypeOfObject; 1248return type.IsDefined(Globals.TypeOfCollectionDataContractAttribute, false); 1296addMethod = t.GetMethod(Globals.AddMethodName) ?? addMethod; 1297getEnumeratorMethod = t.GetMethod(Globals.GetEnumeratorMethodName) ?? getEnumeratorMethod; 1313addMethod = type.GetMethod(Globals.AddMethodName, BindingFlags.Instance | BindingFlags.Public, addMethodTypeArray); 1341addMethod = type.GetMethod(Globals.AddMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, addMethodTypeArray); 1346getEnumeratorMethod = type.GetMethod(Globals.GetEnumeratorMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes); 1347if (getEnumeratorMethod == null || !Globals.TypeOfIEnumerator.IsAssignableFrom(getEnumeratorMethod.ReturnType)) 1351Globals.TypeOfIEnumerable; 1362=> GetTargetMethodWithName(Globals.GetEnumeratorMethodName, type, ienumerableInterface);
System\Runtime\Serialization\DataContract.cs (50)
277writer.WriteStartElement(Globals.SerPrefix, name, ns); 465else if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type)) 470type = Globals.TypeOfReflectionPointer; 475if (!type.IsSerializable && !type.IsDefined(Globals.TypeOfDataContractAttribute, false) && !ClassDataContract.IsNonAttributedTypeValidForSerialization(type)) 538if (type == Globals.TypeOfDateTimeOffset) 540return Globals.TypeOfDateTimeOffsetAdapter; 542if (type == Globals.TypeOfMemoryStream) 544return Globals.TypeOfMemoryStreamAdapter; 553if (type == Globals.TypeOfDateTimeOffsetAdapter) 555return Globals.TypeOfDateTimeOffset; 557if (type == Globals.TypeOfMemoryStreamAdapter) 559return Globals.TypeOfMemoryStream; 565if (Globals.TypeOfDateTimeOffset.TypeHandle.Equals(typeHandle)) 567return Globals.TypeOfDateTimeOffsetAdapter.TypeHandle; 569if (Globals.TypeOfMemoryStream.TypeHandle.Equals(typeHandle)) 571return Globals.TypeOfMemoryStreamAdapter.TypeHandle; 581type = Globals.TypeOfObject; 860else if (ns == Globals.DataContractXmlNamespace) 906s_clrTypeStrings.Add(Globals.TypeOfInt.Assembly.FullName!, s_clrTypeStringsDictionary.Add(Globals.MscorlibAssemblyName)); 1050MethodInfo? method = UnderlyingType.GetMethod(Globals.ParseMethodName, BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(string) }); 1101type.IsDefined(Globals.TypeOfDataContractAttribute, false) || 1105type == Globals.TypeOfDBNull || 1106Globals.TypeOfIXmlSerializable.IsAssignableFrom(type)) 1164while (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) 1174while (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) 1324else if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type)) 1342object[] dataContractAttributes = type.GetCustomAttributes(Globals.TypeOfDataContractAttribute, false).ToArray(); 1367object[] collectionContractAttributes = type.GetCustomAttributes(Globals.TypeOfCollectionDataContractAttribute, false).ToArray(); 1400string arrayOfPrefix = Globals.ArrayPrefix + GetArrayPrefix(ref itemType); 1417arrayOfPrefix += Globals.ArrayPrefix; 1425return IsBuiltInNamespace(elementNs) ? Globals.CollectionsNamespace : elementNs; 1435GenericInfo genericInfo = new GenericInfo(DataContract.GetXmlName(Globals.TypeOfNullable), Globals.TypeOfNullable.FullName!); 1445string name = Globals.ArrayPrefix + itemName.Name; 1568return (ns == Globals.SchemaNamespace || ns == Globals.SerializationNamespace); 1585return new Uri(Globals.DataContractXsdBaseNamespaceUri, clrNs ?? string.Empty).AbsoluteUri; 1659Span<char> formatted = stackalloc char[Globals.SerializationNamespace.Length]; 1661charsWritten == Globals.SerializationNamespace.Length && 1662formatted.SequenceEqual(Globals.SerializationNamespace)) 1664ThrowInvalidDataContractException(SR.Format(SR.DataContractNamespaceReserved, Globals.SerializationNamespace), type); 1698return uriString.StartsWith(Globals.DataContractXsdBaseNamespace, StringComparison.Ordinal) ? uriString.Substring(Globals.DataContractXsdBaseNamespace.Length) : uriString; 1927type.GetGenericTypeDefinition() == Globals.TypeOfNullable); 1950object[] knownTypeAttributes = type.GetCustomAttributes(Globals.TypeOfKnownTypeAttribute, false).ToArray(); 1988if (!Globals.TypeOfTypeEnumerable.IsAssignableFrom(method.ReturnType)) 2025collectionDataContract.ItemType.GetGenericTypeDefinition() == Globals.TypeOfKeyValue) 2027DataContract itemDataContract = DataContract.GetDataContract(Globals.TypeOfKeyValuePair.MakeGenericType(collectionDataContract.ItemType.GetGenericArguments())); 2237Globals.FullSRSInternalsVisibleRegex.IsMatch(internalsVisibleAttributeAssemblyName))
System\Runtime\Serialization\DataContractSerializer.cs (1)
531objType = obj != null ? obj.GetType() : Globals.TypeOfObject;
System\Runtime\Serialization\DataContractSet.cs (8)
177if (collectionDataContract.UnderlyingType != Globals.TypeOfSchemaDefinedType) 321_referencedTypesDictionary.Add(DataContract.GetXmlName(Globals.TypeOfNullable), Globals.TypeOfNullable); 352XmlQualifiedName genericDictionaryName = DataContract.GetXmlName(Globals.TypeOfDictionaryGeneric); 354AddReferencedType(_referencedCollectionTypesDictionary, Globals.TypeOfDictionaryGeneric); 416type.IsDefined(Globals.TypeOfDataContractAttribute, false) || 417(Globals.TypeOfIXmlSerializable.IsAssignableFrom(type) && !type.IsGenericTypeDefinition) || 486bool enableStructureCheck = (type != Globals.TypeOfNullable);
System\Runtime\Serialization\DataMember.cs (1)
113_emitDefaultValue = Globals.DefaultEmitDefaultValue;
System\Runtime\Serialization\DictionaryGlobals.cs (13)
14public static readonly XmlDictionaryString SchemaInstanceNamespace = s_dictionary.Add(Globals.SchemaInstanceNamespace); 15public static readonly XmlDictionaryString SerializationNamespace = s_dictionary.Add(Globals.SerializationNamespace); 16public static readonly XmlDictionaryString SchemaNamespace = s_dictionary.Add(Globals.SchemaNamespace); 17public static readonly XmlDictionaryString XsiTypeLocalName = s_dictionary.Add(Globals.XsiTypeLocalName); 18public static readonly XmlDictionaryString XsiNilLocalName = s_dictionary.Add(Globals.XsiNilLocalName); 21public static readonly XmlDictionaryString IdLocalName = s_dictionary.Add(Globals.IdLocalName); 22public static readonly XmlDictionaryString RefLocalName = s_dictionary.Add(Globals.RefLocalName); 23public static readonly XmlDictionaryString ArraySizeLocalName = s_dictionary.Add(Globals.ArraySizeLocalName); 25public static readonly XmlDictionaryString ISerializableFactoryTypeLocalName = s_dictionary.Add(Globals.ISerializableFactoryTypeLocalName); 28public static readonly XmlDictionaryString XmlnsNamespace = s_dictionary.Add(Globals.XmlnsNamespace); 58public static readonly XmlDictionaryString ClrTypeLocalName = s_dictionary.Add(Globals.ClrTypeLocalName); 59public static readonly XmlDictionaryString ClrAssemblyLocalName = s_dictionary.Add(Globals.ClrAssemblyLocalName); 60public static readonly XmlDictionaryString Space = s_dictionary.Add(Globals.Space);
System\Runtime\Serialization\EnumDataContract.cs (5)
103XmlQualifiedName xmlName = CreateQualifiedName(localName, Globals.SchemaNamespace); 135IsFlags = type.IsDefined(Globals.TypeOfFlagsAttribute, false); 211_isULong = (baseType == Globals.TypeOfULong); 229object[] memberAttributes = field.GetCustomAttributes(Globals.TypeOfEnumMemberAttribute, false).ToArray(); 250object[] dataMemberAttributes = field.GetCustomAttributes(Globals.TypeOfDataMemberAttribute, false).ToArray();
System\Runtime\Serialization\ExtensionDataObject.cs (24)
79private string _id = Globals.NewObjectId; 142get { return (Id != Globals.NewObjectId); } 158AddQualifiedNameAttribute(element, Globals.XsiPrefix, Globals.XsiTypeLocalName, Globals.SchemaInstanceNamespace, DataContractName, DataContractNamespace); 160element.AddAttribute(Globals.SerPrefix, Globals.SerializationNamespace, Globals.ClrTypeLocalName, ClrTypeName); 162element.AddAttribute(Globals.SerPrefix, Globals.SerializationNamespace, Globals.ClrAssemblyLocalName, ClrAssemblyName); 182if (attribute != null && attribute.prefix == Globals.XmlnsPrefix && attribute.localName == prefix) 190element.AddAttribute(Globals.XmlnsPrefix, Globals.XmlnsNamespace, prefix, valueNs); 200dataType = Globals.TypeOfClassDataNode; 224dataType = Globals.TypeOfXmlDataNode; 263dataType = Globals.TypeOfCollectionDataNode; 294element.AddAttribute(Globals.SerPrefix, Globals.SerializationNamespace, Globals.ArraySizeLocalName, Size.ToString(NumberFormatInfo.InvariantInfo)); 313dataType = Globals.TypeOfISerializableDataNode; 339AddQualifiedNameAttribute(element, Globals.SerPrefix, Globals.ISerializableFactoryTypeLocalName, Globals.SerializationNamespace, FactoryTypeName, FactoryTypeNamespace);
System\Runtime\Serialization\ExtensionDataReader.cs (27)
59AddPrefix(Globals.XsiPrefix, Globals.SchemaInstanceNamespace); 60AddPrefix(Globals.SerPrefix, Globals.SerializationNamespace); 462if (dataNodeType == Globals.TypeOfClassDataNode) 464else if (dataNodeType == Globals.TypeOfCollectionDataNode) 466else if (dataNodeType == Globals.TypeOfISerializableDataNode) 468else if (dataNodeType == Globals.TypeOfXmlDataNode) 491_nextElement.AddAttribute(Globals.XsiPrefix, Globals.SchemaInstanceNamespace, Globals.XsiNilLocalName, Globals.True); 505if (node.Id != Globals.NewObjectId && (node.Value == null || !node.IsFinalValue)) 515if (node.Id != Globals.NewObjectId) 522_nextElement.AddAttribute(Globals.SerPrefix, Globals.SerializationNamespace, Globals.RefLocalName, node.Id.ToString(NumberFormatInfo.InvariantInfo)); 523_nextElement.AddAttribute(Globals.XsiPrefix, Globals.SchemaInstanceNamespace, Globals.XsiNilLocalName, Globals.True); 633if (type == Globals.TypeOfObject && dataNode.Value != null) 636if (type == Globals.TypeOfObject) 712if (type == Globals.TypeOfByteArray) 717else if (type == Globals.TypeOfTimeSpan) 719else if (type == Globals.TypeOfGuid) 724else if (type == Globals.TypeOfUri)
System\Runtime\Serialization\Globals.cs (4)
28s_idQualifiedName ??= new XmlQualifiedName(Globals.IdLocalName, Globals.SerializationNamespace); 32s_refQualifiedName ??= new XmlQualifiedName(Globals.RefLocalName, Globals.SerializationNamespace);
System\Runtime\Serialization\Json\DataContractJsonSerializer.cs (2)
564if (itemType.IsGenericType && (itemType.GetGenericTypeDefinition() == Globals.TypeOfKeyValue)) 566itemType = Globals.TypeOfKeyValuePair.MakeGenericType(itemType.GenericTypeArguments);
System\Runtime\Serialization\Json\JsonDataContract.cs (2)
245traditionalDataContract.UnderlyingType == Globals.TypeOfXmlQualifiedName) 298DataContract itemDataContract = DataContract.GetDataContract(Globals.TypeOfKeyValuePair.MakeGenericType(collectionDataContract.ItemType.GenericTypeArguments));
System\Runtime\Serialization\Json\JsonFormatGeneratorStatics.cs (26)
108s_collectionItemNameProperty = typeof(XmlObjectSerializerWriteContextComplexJson).GetProperty("CollectionItemName", Globals.ScanAllMembers); 118typeof(ExtensionDataObject).GetConstructor(Globals.ScanAllMembers, Type.EmptyTypes))!; 141s_getItemContractMethod = typeof(CollectionDataContract).GetProperty("ItemContract", Globals.ScanAllMembers)!.GetGetMethod(nonPublic: true); 154s_getJsonDataContractMethod = typeof(JsonDataContract).GetMethod("GetJsonDataContract", Globals.ScanAllMembers); 167s_getJsonMemberIndexMethod = typeof(XmlObjectSerializerReadContextComplexJson).GetMethod("GetJsonMemberIndex", Globals.ScanAllMembers); 180s_getRevisedItemContractMethod = typeof(XmlObjectSerializerWriteContextComplexJson).GetMethod("GetRevisedItemContract", Globals.ScanAllMembers); 193s_getUninitializedObjectMethod = typeof(XmlFormatReaderGenerator).GetMethod("UnsafeGetUninitializedObject", Globals.ScanAllMembers, new Type[] { typeof(Type) }); 206s_isStartElementMethod0 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, Type.EmptyTypes); 218s_isStartElementMethod2 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) }); 230s_localNameProperty = typeof(XmlReaderDelegator).GetProperty("LocalName", Globals.ScanAllMembers); 242s_namespaceProperty = typeof(XmlReaderDelegator).GetProperty("NamespaceProperty", Globals.ScanAllMembers); 266s_moveToContentMethod = typeof(XmlReaderDelegator).GetMethod("MoveToContent", Globals.ScanAllMembers); 278s_nodeTypeProperty = typeof(XmlReaderDelegator).GetProperty("NodeType", Globals.ScanAllMembers); 304s_readJsonValueMethod = typeof(DataContractJsonSerializer).GetMethod("ReadJsonValue", Globals.ScanAllMembers); 329s_throwDuplicateMemberExceptionMethod = typeof(XmlObjectSerializerReadContextComplexJson).GetMethod("ThrowDuplicateMemberException", Globals.ScanAllMembers); 341s_throwMissingRequiredMembersMethod = typeof(XmlObjectSerializerReadContextComplexJson).GetMethod("ThrowMissingRequiredMembers", Globals.ScanAllMembers); 377s_useSimpleDictionaryFormatReadProperty = typeof(XmlObjectSerializerReadContextComplexJson).GetProperty("UseSimpleDictionaryFormat", Globals.ScanAllMembers); 389s_useSimpleDictionaryFormatWriteProperty = typeof(XmlObjectSerializerWriteContextComplexJson).GetProperty("UseSimpleDictionaryFormat", Globals.ScanAllMembers); 401s_writeAttributeStringMethod = typeof(XmlWriterDelegator).GetMethod("WriteAttributeString", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(string), typeof(string), typeof(string) }); 413s_writeEndElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteEndElement", Globals.ScanAllMembers, Type.EmptyTypes); 426s_writeJsonISerializableMethod = typeof(XmlObjectSerializerWriteContextComplexJson).GetMethod("WriteJsonISerializable", Globals.ScanAllMembers); 438s_writeJsonNameWithMappingMethod = typeof(XmlObjectSerializerWriteContextComplexJson).GetMethod("WriteJsonNameWithMapping", Globals.ScanAllMembers); 451s_writeJsonValueMethod = typeof(DataContractJsonSerializer).GetMethod("WriteJsonValue", Globals.ScanAllMembers); 463s_writeStartElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) }); 476s_writeStartElementStringMethod = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(string) }); 502s_getJsonMemberNameMethod = typeof(XmlObjectSerializerReadContextComplexJson).GetMethod("GetJsonMemberName", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator) });
System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs (43)
92if (Globals.TypeOfIDeserializationCallback.IsAssignableFrom(classContract.UnderlyingType)) 105if (classContract.UnderlyingType == Globals.TypeOfDateTimeOffsetAdapter) 107_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfDateTimeOffsetAdapter); 109_ilg.ConvertValue(Globals.TypeOfDateTimeOffset, _ilg.CurrentMethod.ReturnType); 111else if (classContract.UnderlyingType == Globals.TypeOfMemoryStreamAdapter) 113_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfMemoryStreamAdapter); 115_ilg.ConvertValue(Globals.TypeOfMemoryStream, _ilg.CurrentMethod.ReturnType); 206if (classContract.UnderlyingType == Globals.TypeOfDBNull) 208_ilg.LoadMember(Globals.TypeOfDBNull.GetField("Value")!); 227_ilg.ConvertValue(Globals.TypeOfObject, type); 262return Globals.TypeOfIObjectReference.IsAssignableFrom(classContract.UnderlyingType); 271_ilg.ConvertAddress(_objectLocal.LocalType, Globals.TypeOfIObjectReference); 272_ilg.Load(Globals.NewObjectId); 274_ilg.ConvertValue(Globals.TypeOfObject, _ilg.CurrentMethod.ReturnType); 287LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 319LocalBuilder memberIndexLocal = _ilg.DeclareLocal(Globals.TypeOfInt, -1); 347_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfObject); 412LocalBuilder localArray = _ilg.DeclareLocal(Globals.TypeOfByteArray); 454ConstructorInfo? ctor = classContract.UnderlyingType.GetConstructor(Globals.ScanAllMembers, JsonFormatGeneratorStatics.SerInfoCtorArgs); 472while (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) 479if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 481LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 486_ilg.If(objectId, Cmp.EqualTo, Globals.NullObjectId); 518if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 536_ilg.ConvertValue(Globals.TypeOfObject, type); 543_ilg.If(objectId, Cmp.NotEqualTo, Globals.NullObjectId); 576_ilg.ConvertValue(Globals.TypeOfObject, type); 590Type type = Globals.TypeOfNullable.MakeGenericType(innerType); 610type = Globals.TypeOfDictionaryGeneric.MakeGenericType(itemType.GetGenericArguments()); 614type = Globals.TypeOfHashtable; 658LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 676LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 734while (keyType.IsGenericType && keyType.GetGenericTypeDefinition() == Globals.TypeOfNullable) 745if (keyType == Globals.TypeOfString || keyType == Globals.TypeOfObject) 796_ilg.ConvertValue(Globals.TypeOfObject, keyType); 825LocalBuilder size = _ilg.DeclareLocal(Globals.TypeOfInt); 830_ilg.ConvertValue(Globals.TypeOfObject, type); 873LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 954_ilg.Call(typeof(JsonReaderDelegator).GetMethod(readArrayMethod, Globals.ScanAllMembers)!); 974_ilg.ConvertValue(Globals.TypeOfObject, itemType); 1013if (collectionContract.AddMethod.ReturnType != Globals.TypeOfVoid) 1023if (collectionContract.AddMethod.ReturnType != Globals.TypeOfVoid)
System\Runtime\Serialization\Json\JsonFormatWriterGenerator.cs (39)
140if (objType == Globals.TypeOfDateTimeOffsetAdapter) 142_ilg.ConvertValue(objectArg.ArgType, Globals.TypeOfDateTimeOffset); 145else if (objType == Globals.TypeOfMemoryStreamAdapter) 147_ilg.ConvertValue(objectArg.ArgType, Globals.TypeOfMemoryStream); 213LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 215_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfIExtensibleDataObject); 317LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 354incrementCollectionCountMethod = XmlFormatGeneratorStatics.IncrementCollectionCountGenericMethod.MakeGenericMethod(Globals.TypeOfKeyValuePair.MakeGenericType(collectionContract.ItemType.GetGenericArguments())); 369enumeratorType = Globals.TypeOfGenericDictionaryEnumerator.MakeGenericType(keyValueTypes); 374keyValueTypes = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject }; 375enumeratorType = Globals.TypeOfDictionaryEnumerator; 381MethodInfo? moveNextMethod = enumeratorType.GetMethod(Globals.MoveNextMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes); 382MethodInfo? getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes); 392Type ienumeratorInterface = Globals.TypeOfIEnumerator; 400&& interfaceType.GetGenericTypeDefinition() == Globals.TypeOfIEnumeratorGeneric 409moveNextMethod ??= CollectionDataContract.GetTargetMethodWithName(Globals.MoveNextMethodName, enumeratorType, ienumeratorInterface)!; 410getCurrentMethod ??= CollectionDataContract.GetTargetMethodWithName(Globals.GetCurrentMethodName, enumeratorType, ienumeratorInterface)!; 420ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { Globals.TypeOfIDictionaryEnumerator })!; 421_ilg.ConvertValue(collectionContract.GetEnumeratorMethod.ReturnType, Globals.TypeOfIDictionaryEnumerator); 427Type ctorParam = Globals.TypeOfIEnumeratorGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(keyValueTypes)); 428ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { ctorParam })!; 438Type genericDictionaryKeyValueType = Globals.TypeOfKeyValue.MakeGenericType(keyValueTypes); 446LocalBuilder pairKey = _ilg.DeclareLocal(Globals.TypeOfString); 485_ilg.ConvertValue(currentValue.LocalType, Globals.TypeOfObject); 511if (primitiveContract == null || primitiveContract.UnderlyingType == Globals.TypeOfObject) 595Globals.ScanAllMembers, 636memberType.GetGenericTypeDefinition() == Globals.TypeOfNullable); 662if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 675if (memberType == Globals.TypeOfObject || //boxed Nullable<T> 676memberType == Globals.TypeOfValueType || 677((IList)Globals.TypeOfNullable.GetInterfaces()).Contains(memberType)) 680_ilg.ConvertValue(memberValue.LocalType, Globals.TypeOfObject); 681memberValue = _ilg.DeclareLocal(Globals.TypeOfObject); 691if (memberType == Globals.TypeOfObject) //boxed Nullable<T> 703_ilg.ConvertValue(memberValue.LocalType, Globals.TypeOfObject); 725while (memberType.IsGenericType && memberType.GetGenericTypeDefinition() == Globals.TypeOfNullable)
System\Runtime\Serialization\Json\JsonGlobals.cs (1)
19public static readonly int DataContractXsdBaseNamespaceLength = Globals.DataContractXsdBaseNamespace.Length;
System\Runtime\Serialization\Json\JsonObjectDataContract.cs (2)
50return DataContractJsonSerializer.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context); 70throw new XmlException(SR.Format(SR.XmlInvalidConversion, value, Globals.TypeOfInt));
System\Runtime\Serialization\Json\ReflectionJsonFormatReader.cs (3)
154while (keyType.IsGenericType && keyType.GetGenericTypeDefinition() == Globals.TypeOfNullable) 165if (keyType == Globals.TypeOfString || keyType == Globals.TypeOfObject)
System\Runtime\Serialization\Json\ReflectionJsonFormatWriter.cs (1)
90if (primitiveContractForType != null && primitiveContractForType.UnderlyingType != Globals.TypeOfObject)
System\Runtime\Serialization\Json\XmlJsonWriter.cs (2)
221if (ns == Globals.XmlnsNamespace) 223return Globals.XmlnsPrefix;
System\Runtime\Serialization\Json\XmlObjectSerializerReadContextComplexJson.cs (2)
166serverTypeNamespace = string.Concat(Globals.DataContractXsdBaseNamespace, serverTypeNamespace.AsSpan(1)); 199serverTypeNamespace = string.Concat(Globals.DataContractXsdBaseNamespace, serverTypeNamespace.AsSpan(1));
System\Runtime\Serialization\Json\XmlObjectSerializerWriteContextComplexJson.cs (11)
87else if (dataContractNamespace.StartsWith(Globals.DataContractXsdBaseNamespace, StringComparison.Ordinal)) 104(contract.UnderlyingType != Globals.TypeOfObjectArray) && 236dataContract = GetDataContract(Globals.TypeOfIEnumerable); 295if (dataType == Globals.TypeOfClassDataNode || 296dataType == Globals.TypeOfISerializableDataNode) 301else if (dataType == Globals.TypeOfCollectionDataNode) 306else if (dataType == Globals.TypeOfXmlDataNode) 310else if ((dataType == Globals.TypeOfObject) && (dataNode.Value != null)) 323if ((contractType == typeof(XmlDataContract)) && !Globals.TypeOfIXmlSerializable.IsAssignableFrom(declaredType)) 360(oldItemContract.UnderlyingType.GetGenericTypeDefinition() == Globals.TypeOfKeyValue)) 415itemContract = context.GetDataContract(Globals.TypeOfKeyValuePair.MakeGenericType(collectionContract.ItemType.GetGenericArguments()));
System\Runtime\Serialization\MemoryStreamAdapter.cs (2)
9[DataContract(Name = nameof(MarshalByRefObject), Namespace = Globals.DataContractXsdBaseNamespace + "System")] 22[DataContract(Name = "MemoryStream", Namespace = Globals.DataContractXsdBaseNamespace + "System.IO")]
System\Runtime\Serialization\PrimitiveDataContract.cs (8)
70_helper.XmlFormatWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { UnderlyingType, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!; 72_helper.XmlFormatWriterMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), UnderlyingType, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!; 86_helper.XmlFormatContentWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { UnderlyingType })!; 88_helper.XmlFormatContentWriterMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), UnderlyingType })!; 95_helper.XmlFormatReaderMethod ??= typeof(XmlReaderDelegator).GetMethod(ReadMethodName, Globals.ScanAllMembers)!; 114if (attributes.Ref != Globals.NewObjectId) 1101writer.WriteStartElement(Globals.SerPrefix, name, ns); 1103writer.WriteStartElement(Globals.ElementPrefix, name, ns);
System\Runtime\Serialization\ReflectionClassWriter.cs (6)
50bool originValueIsNullableOfT = (memberType.IsGenericType && memberType.GetGenericTypeDefinition() == Globals.TypeOfNullable); 88if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject && !writeXsiType) 95(memberType == Globals.TypeOfObject 122if (primitiveContract == null || primitiveContract.UnderlyingType == Globals.TypeOfObject) 155if (type == Globals.TypeOfDateTimeOffset) 159else if (type == Globals.TypeOfMemoryStream)
System\Runtime\Serialization\ReflectionReader.cs (11)
27private static readonly Type[] s_arrayConstructorParameters = new Type[] { Globals.TypeOfInt }; 253while (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) 263if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 294if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 348while (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) 355if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 442if (objType == Globals.TypeOfDateTimeOffsetAdapter) 446else if (objType == Globals.TypeOfMemoryStreamAdapter) 489Type type = Globals.TypeOfDictionaryGeneric.MakeGenericType(collectionContract.ItemType.GetGenericArguments()); 501else if (collectionContract.UnderlyingType == Globals.TypeOfIDictionary) 586Type typeIList = Globals.TypeOfIList;
System\Runtime\Serialization\ReflectionXmlFormatWriter.cs (3)
61if (primitiveContractForType != null && primitiveContractForType.UnderlyingType != Globals.TypeOfObject) 212xmlWriter.WriteStartElement(Globals.ElementPrefix, nameLocal, namespaceLocal); 227return type == Globals.TypeOfXmlQualifiedName && (ns != null && ns.Value != null && ns.Value.Length > 0);
System\Runtime\Serialization\SchemaExporter.cs (62)
66if (!Schemas.Contains(Globals.SerializationNamespace)) 68StringReader reader = new StringReader(Globals.SerializationSchema); 71throw new InvalidOperationException(SR.Format(SR.CouldNotReadSerializationSchema, Globals.SerializationNamespace)); 126genericInfoElement = ExportGenericInfo(classDataContract.UnderlyingType, Globals.GenericTypeLocalName, Globals.SerializationNamespace); 178SchemaHelper.AddSchemaImport(Globals.SerializationNamespace, schema); 179schema.Namespaces.Add(Globals.SerPrefixForSchema, Globals.SerializationNamespace); 194if (element.SchemaTypeName.Namespace.Equals(Globals.SerializationNamespace)) 195schema.Namespaces.Add(Globals.SerPrefixForSchema, Globals.SerializationNamespace); 222XmlAttribute emitDefaultValueAttribute = XmlDoc.CreateAttribute(Globals.EmitDefaultValueAttribute); 223emitDefaultValueAttribute.Value = Globals.False; 237XmlAttribute nameAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNameAttribute); 241XmlAttribute nsAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNamespaceAttribute); 291collectionName = Globals.ArrayPrefix + collectionName; 296XmlAttribute nameAttribute = XmlDoc.CreateAttribute(Globals.GenericNameAttribute); 301XmlAttribute nsAttribute = XmlDoc.CreateAttribute(Globals.GenericNamespaceAttribute); 314XmlElement argumentElement = ExportGenericInfo(genericArguments[argIndex], Globals.GenericParameterLocalName, Globals.SerializationNamespace); 317XmlAttribute nestedLevelAttribute = XmlDoc.CreateAttribute(Globals.GenericParameterNestedLevelAttribute); 327XmlAttribute typeNestedLevelsAttribute = XmlDoc.CreateAttribute(Globals.GenericParameterNestedLevelAttribute); 350DataContractSerializer serializer = new DataContractSerializer(Globals.TypeOfObject, 368genericInfoElement = ExportGenericInfo(collectionDataContract.UnderlyingType, Globals.GenericTypeLocalName, Globals.SerializationNamespace); 378element.MaxOccursString = Globals.OccursUnbounded; 417isDictionaryElement.InnerText = Globals.True; 471genericInfoElement = ExportGenericInfo(dataContract.UnderlyingType, Globals.GenericTypeLocalName, Globals.SerializationNamespace); 480schema.Namespaces.Add(Globals.SerPrefixForSchema, Globals.SerializationNamespace); 610object[] attrs = clrType.GetCustomAttributes(Globals.TypeOfXmlSchemaProviderAttribute, false); 636if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)) && !(Globals.TypeOfXmlSchemaType.IsAssignableFrom(getMethod.ReturnType))) 637throw new InvalidDataContractException(SR.Format(SR.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName), typeof(XmlSchemaType))); 751if (type == Globals.TypeOfXmlElement || type == Globals.TypeOfXmlNodeArray) 754if (type == Globals.TypeOfXmlElement) 779schemaRefElement.RefName = new XmlQualifiedName(Globals.SchemaLocalName, XmlSchema.Namespace); 867iSerializableWildcardElement.MaxOccursString = Globals.OccursUnbounded; 875internal static XmlQualifiedName AnytypeQualifiedName => s_anytypeQualifiedName ??= new XmlQualifiedName(Globals.AnyTypeLocalName, Globals.SchemaNamespace); 878internal static XmlQualifiedName StringQualifiedName => s_stringQualifiedName ??= new XmlQualifiedName(Globals.StringLocalName, Globals.SchemaNamespace); 881internal static XmlQualifiedName DefaultEnumBaseTypeName => s_defaultEnumBaseTypeName ??= new XmlQualifiedName(Globals.IntLocalName, Globals.SchemaNamespace); 884internal static XmlQualifiedName EnumerationValueAnnotationName => s_enumerationValueAnnotationName ??= new XmlQualifiedName(Globals.EnumerationValueLocalName, Globals.SerializationNamespace); 887internal static XmlQualifiedName SurrogateDataAnnotationName => s_surrogateDataAnnotationName ??= new XmlQualifiedName(Globals.SurrogateDataLocalName, Globals.SerializationNamespace); 890internal static XmlQualifiedName DefaultValueAnnotation => s_defaultValueAnnotation ??= new XmlQualifiedName(Globals.DefaultValueLocalName, Globals.SerializationNamespace); 893internal static XmlQualifiedName ActualTypeAnnotationName => s_actualTypeAnnotationName ??= new XmlQualifiedName(Globals.ActualTypeLocalName, Globals.SerializationNamespace); 896internal static XmlQualifiedName IsDictionaryAnnotationName => s_isDictionaryAnnotationName ??= new XmlQualifiedName(Globals.IsDictionaryLocalName, Globals.SerializationNamespace); 899internal static XmlQualifiedName IsValueTypeName => s_isValueTypeName ??= new XmlQualifiedName(Globals.IsValueTypeLocalName, Globals.SerializationNamespace); 908iSerializableFactoryTypeAttribute.RefName = new XmlQualifiedName(Globals.ISerializableFactoryTypeLocalName, Globals.SerializationNamespace); 920refAttribute.RefName = Globals.RefQualifiedName; 932idAttribute.RefName = Globals.IdQualifiedName;
System\Runtime\Serialization\SchemaHelper.cs (3)
138schema.Namespaces.Add(Globals.TnsPrefix, ns); 156if (SchemaHelper.NamespacesEqual(ns, schema.TargetNamespace) || SchemaHelper.NamespacesEqual(ns, Globals.SchemaNamespace) || SchemaHelper.NamespacesEqual(ns, Globals.SchemaInstanceNamespace))
System\Runtime\Serialization\SchemaImporter.cs (50)
50if (!_schemaSet.Contains(Globals.SerializationNamespace)) 52StringReader reader = new StringReader(Globals.SerializationSchema); 55throw new InvalidOperationException(SR.Format(SR.CouldNotReadSerializationSchema, Globals.SerializationNamespace)); 78if (schema.TargetNamespace != Globals.SerializationNamespace 79&& schema.TargetNamespace != Globals.SchemaNamespace) 143element.Name = Globals.SchemaLocalName; 207return dataContract is PrimitiveDataContract && ((PrimitiveDataContract)dataContract).UnderlyingType == Globals.TypeOfObject; 250if (schema.TargetNamespace != Globals.SerializationNamespace) 506if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(referencedType)) 574return (localElement.MaxOccursString == Globals.OccursUnbounded || localElement.MaxOccurs > 1); 597element.RefName.Namespace == Globals.SerializationNamespace && 602XmlSchema serializationSchema = XmlSchema.Read(XmlReader.Create(new StringReader(Globals.SerializationSchema)), null)!; // Source is our constant. Schema is valid. 655ClassDataContract dataContract = new ClassDataContract(Globals.TypeOfSchemaDefinedType); 706xmlDataContract = new XmlDataContract(Globals.TypeOfSchemaDefinedType); 741&& Globals.TypeOfIXmlSerializable.IsAssignableFrom(referencedType)) 748return (XmlDataContract?)DataContract.GetBuiltInDataContract(Globals.TypeOfXmlElement); 751return (XmlDataContract?)DataContract.GetBuiltInDataContract(Globals.TypeOfXmlNodeArray); 825ClassDataContract dataContract = new ClassDataContract(Globals.TypeOfSchemaDefinedType); 995memberEmitDefaultValue = emitDefaultValueFromAnnotation != null ? emitDefaultValueFromAnnotation.Value : Globals.DefaultEmitDefaultValue; 1004if (prevMember.Order > Globals.DefaultOrder) 1026XmlNode? emitDefaultValueAttribute = defaultValueElement.Attributes.GetNamedItem(Globals.EmitDefaultValueAttribute); 1028throw new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, SchemaExporter.DefaultValueAnnotation.Name, typeName.Name, typeName.Namespace, Globals.EmitDefaultValueAttribute)); 1038XmlNode? nameAttribute = actualTypeElement.Attributes.GetNamedItem(Globals.ActualTypeNameAttribute); 1040throw new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, SchemaExporter.ActualTypeAnnotationName.Name, typeName.Name, typeName.Namespace, Globals.ActualTypeNameAttribute)); 1041XmlNode? nsAttribute = actualTypeElement.Attributes.GetNamedItem(Globals.ActualTypeNamespaceAttribute); 1043throw new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, SchemaExporter.ActualTypeAnnotationName.Name, typeName.Name, typeName.Namespace, Globals.ActualTypeNamespaceAttribute)); 1051CollectionDataContract dataContract = new CollectionDataContract(Globals.TypeOfSchemaDefinedType, CollectionKind.Array); 1122GenericInfo genericInfo = new GenericInfo(DataContract.GetXmlName(Globals.TypeOfKeyValue), Globals.TypeOfKeyValue.FullName); 1140genericInfo = new GenericInfo(DataContract.GetXmlName(Globals.TypeOfNullable), Globals.TypeOfNullable.FullName); 1195EnumDataContract dataContract = new EnumDataContract(Globals.TypeOfSchemaDefinedEnum); 1216DataMember dataMember = new DataMember(Globals.SchemaMemberInfoPlaceholder) { Name = enumFacet.Value, Order = enumValue }; 1273if (typeElement != null && typeElement.NamespaceURI == Globals.SerializationNamespace) 1275if (typeElement.LocalName == Globals.GenericTypeLocalName) 1285string? name = typeElement.Attributes.GetNamedItem(Globals.GenericNameAttribute)?.Value; 1287throw new InvalidDataContractException(SR.Format(SR.GenericAnnotationAttributeNotFound, type.Name, Globals.GenericNameAttribute)); 1288string? ns = typeElement.Attributes.GetNamedItem(Globals.GenericNamespaceAttribute)?.Value; 1290throw new InvalidDataContractException(SR.Format(SR.GenericAnnotationAttributeNotFound, type.Name, Globals.GenericNamespaceAttribute)); 1300if (argumentElement.LocalName != Globals.GenericParameterLocalName || 1301argumentElement.NamespaceURI != Globals.SerializationNamespace) 1303XmlNode? nestedLevelAttribute = argumentElement.Attributes.GetNamedItem(Globals.GenericParameterNestedLevelAttribute); 1308throw new InvalidDataContractException(SR.Format(SR.GenericAnnotationHasInvalidAttributeValue, argumentElement.LocalName, argumentElement.NamespaceURI, type.Name, nestedLevelAttribute.Value, nestedLevelAttribute.LocalName, Globals.TypeOfInt.Name)); 1318XmlNode? typeNestedLevelsAttribute = typeElement.Attributes.GetNamedItem(Globals.GenericParameterNestedLevelAttribute); 1323throw new InvalidDataContractException(SR.Format(SR.GenericAnnotationHasInvalidAttributeValue, typeElement.LocalName, typeElement.NamespaceURI, type.Name, typeNestedLevelsAttribute.Value, typeNestedLevelsAttribute.LocalName, Globals.TypeOfInt.Name)); 1338DataContractSerializer serializer = new DataContractSerializer(Globals.TypeOfObject, name, ns, knownTypes, 1381if (TryCheckIfAttribute(typeName, attribute, Globals.IdQualifiedName, ref foundId)) 1383if (TryCheckIfAttribute(typeName, attribute, Globals.RefQualifiedName, ref foundRef)) 1385if (attribute.RefName.IsEmpty || attribute.RefName.Namespace != Globals.SerializationNamespace || attribute.Use == XmlSchemaUse.Required) 1386ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.TypeShouldNotContainAttributes, Globals.SerializationNamespace));
System\Runtime\Serialization\XmlDataContract.cs (7)
121public override bool IsBuiltInDataContract => UnderlyingType == Globals.TypeOfXmlElement || UnderlyingType == Globals.TypeOfXmlNodeArray; 140if (type.IsDefined(Globals.TypeOfDataContractAttribute, false)) 142if (type.IsDefined(Globals.TypeOfCollectionDataContractAttribute, false)) 154object[]? xmlRootAttributes = UnderlyingType?.GetCustomAttributes(Globals.TypeOfXmlRootAttribute, false).ToArray(); 160_topLevelElementNamespace = (this.XmlName.Namespace == Globals.SchemaNamespace) ? DictionaryGlobals.EmptyString : Namespace; 327ilg.ConvertValue(this.UnderlyingType, Globals.TypeOfIXmlSerializable);
System\Runtime\Serialization\XmlFormatGeneratorStatics.cs (73)
22s_writeStartElementMethod2 = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) }); 36s_writeStartElementMethod3 = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(XmlDictionaryString), typeof(XmlDictionaryString) }); 50s_writeEndElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteEndElement", Globals.ScanAllMembers, Type.EmptyTypes); 64s_writeNamespaceDeclMethod = typeof(XmlWriterDelegator).GetMethod("WriteNamespaceDecl", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString) }); 84s_dictionaryEnumeratorCtor = typeof(CollectionDataContract.DictionaryEnumerator).GetConstructor(Globals.ScanAllMembers, new Type[] { Globals.TypeOfIDictionaryEnumerator }); 127s_getItemContractMethod = typeof(CollectionDataContract).GetProperty("ItemContract", Globals.ScanAllMembers)!.GetMethod; 141s_isStartElementMethod2 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) }); 155s_isStartElementMethod0 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, Type.EmptyTypes); 170s_getUninitializedObjectMethod = typeof(XmlFormatReaderGenerator).GetMethod("UnsafeGetUninitializedObject", Globals.ScanAllMembers, new Type[] { typeof(int) })!; 201s_nodeTypeProperty = typeof(XmlReaderDelegator).GetProperty("NodeType", Globals.ScanAllMembers); 212internal static ConstructorInfo ExtensionDataObjectCtor => s_extensionDataObjectCtor ??= typeof(ExtensionDataObject).GetConstructor(Globals.ScanAllMembers, Type.EmptyTypes)!; 223s_hashtableCtor = Globals.TypeOfHashtable.GetConstructor(Globals.ScanAllMembers, Type.EmptyTypes); 237s_getStreamingContextMethod = typeof(XmlObjectSerializerContext).GetMethod("GetStreamingContext", Globals.ScanAllMembers); 251s_getCollectionMemberMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetCollectionMember", Globals.ScanAllMembers); 265s_storeCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("StoreCollectionMemberInfo", Globals.ScanAllMembers, new Type[] { typeof(object) }); 279s_resetCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ResetCollectionMemberInfo", Globals.ScanAllMembers, Type.EmptyTypes); 293s_storeIsGetOnlyCollectionMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("StoreIsGetOnlyCollection", Globals.ScanAllMembers); 307s_resetIsGetOnlyCollection = typeof(XmlObjectSerializerWriteContext).GetMethod("ResetIsGetOnlyCollection", Globals.ScanAllMembers); 321s_throwNullValueReturnedForGetOnlyCollectionExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ThrowNullValueReturnedForGetOnlyCollectionException", Globals.ScanAllMembers); 335s_throwArrayExceededSizeExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ThrowArrayExceededSizeException", Globals.ScanAllMembers); 349s_incrementItemCountMethod = typeof(XmlObjectSerializerContext).GetMethod("IncrementItemCount", Globals.ScanAllMembers); 364s_internalDeserializeMethod = typeof(XmlObjectSerializerReadContext).GetMethod("InternalDeserialize", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator), typeof(int), typeof(RuntimeTypeHandle), typeof(string), typeof(string) }); 378s_moveToNextElementMethod = typeof(XmlObjectSerializerReadContext).GetMethod("MoveToNextElement", Globals.ScanAllMembers); 393s_getMemberIndexMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetMemberIndex", Globals.ScanAllMembers); 408s_getMemberIndexWithRequiredMembersMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetMemberIndexWithRequiredMembers", Globals.ScanAllMembers); 422s_throwRequiredMemberMissingExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ThrowRequiredMemberMissingException", Globals.ScanAllMembers); 436s_skipUnknownElementMethod = typeof(XmlObjectSerializerReadContext).GetMethod("SkipUnknownElement", Globals.ScanAllMembers); 451s_readIfNullOrRefMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ReadIfNullOrRef", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator), typeof(Type), typeof(bool) }); 465s_readAttributesMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ReadAttributes", Globals.ScanAllMembers); 479s_resetAttributesMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ResetAttributes", Globals.ScanAllMembers); 493s_getObjectIdMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetObjectId", Globals.ScanAllMembers); 507s_getArraySizeMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetArraySize", Globals.ScanAllMembers); 521s_addNewObjectMethod = typeof(XmlObjectSerializerReadContext).GetMethod("AddNewObject", Globals.ScanAllMembers); 535s_addNewObjectWithIdMethod = typeof(XmlObjectSerializerReadContext).GetMethod("AddNewObjectWithId", Globals.ScanAllMembers); 549s_replaceDeserializedObjectMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ReplaceDeserializedObject", Globals.ScanAllMembers); 564s_getExistingObjectMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetExistingObject", Globals.ScanAllMembers); 578s_getRealObjectMethod = typeof(XmlObjectSerializerReadContext).GetMethod("GetRealObject", Globals.ScanAllMembers); 592s_ensureArraySizeMethod = typeof(XmlObjectSerializerReadContext).GetMethod("EnsureArraySize", Globals.ScanAllMembers); 606s_trimArraySizeMethod = typeof(XmlObjectSerializerReadContext).GetMethod("TrimArraySize", Globals.ScanAllMembers); 620s_checkEndOfArrayMethod = typeof(XmlObjectSerializerReadContext).GetMethod("CheckEndOfArray", Globals.ScanAllMembers); 649s_readSerializationInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ReadSerializationInfo", Globals.ScanAllMembers); 663s_createUnexpectedStateExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("CreateUnexpectedStateException", Globals.ScanAllMembers, new Type[] { typeof(XmlNodeType), typeof(XmlReaderDelegator) }); 678s_internalSerializeReferenceMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("InternalSerializeReference", Globals.ScanAllMembers); 693s_internalSerializeMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("InternalSerialize", Globals.ScanAllMembers); 708s_writeNullMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("WriteNull", Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), typeof(Type), typeof(bool) }); 722s_incrementArrayCountMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("IncrementArrayCount", Globals.ScanAllMembers); 736s_incrementCollectionCountMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("IncrementCollectionCount", Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), typeof(ICollection) }); 750s_incrementCollectionCountGenericMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("IncrementCollectionCountGeneric", Globals.ScanAllMembers); 764s_getDefaultValueMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(nameof(XmlObjectSerializerWriteContext.GetDefaultValue), Globals.ScanAllMembers); 786s_getNullableValueMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("GetNullableValue", Globals.ScanAllMembers); 800s_throwRequiredMemberMustBeEmittedMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("ThrowRequiredMemberMustBeEmitted", Globals.ScanAllMembers); 814s_getHasValueMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("GetHasValue", Globals.ScanAllMembers); 829s_writeISerializableMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("WriteISerializable", Globals.ScanAllMembers); 840get => s_writeExtensionDataMethod ??= typeof(XmlObjectSerializerWriteContext).GetMethod("WriteExtensionData", Globals.ScanAllMembers)!; 851s_writeXmlValueMethod = typeof(DataContract).GetMethod("WriteXmlValue", Globals.ScanAllMembers); 866s_readXmlValueMethod = typeof(DataContract).GetMethod("ReadXmlValue", Globals.ScanAllMembers); 880s_namespaceProperty = typeof(DataContract).GetProperty("Namespace", Globals.ScanAllMembers); 894s_contractNamespacesField = typeof(ClassDataContract).GetField("ContractNamespaces", Globals.ScanAllMembers); 908s_memberNamesField = typeof(ClassDataContract).GetField("MemberNames", Globals.ScanAllMembers); 916internal static MethodInfo ExtensionDataSetExplicitMethodInfo => s_extensionDataSetExplicitMethodInfo ??= typeof(IExtensibleDataObject).GetMethod(Globals.ExtensionDataSetMethod)!; 926s_childElementNamespacesProperty = typeof(ClassDataContract).GetProperty("ChildElementNamespaces", Globals.ScanAllMembers); 940s_collectionItemNameProperty = typeof(CollectionDataContract).GetProperty("CollectionItemName", Globals.ScanAllMembers); 955s_childElementNamespaceProperty = typeof(CollectionDataContract).GetProperty("ChildElementNamespace", Globals.ScanAllMembers); 969s_getDateTimeOffsetMethod = typeof(DateTimeOffsetAdapter).GetMethod("GetDateTimeOffset", Globals.ScanAllMembers); 983s_getDateTimeOffsetAdapterMethod = typeof(DateTimeOffsetAdapter).GetMethod("GetDateTimeOffsetAdapter", Globals.ScanAllMembers); 997s_getMemoryStreamMethod = typeof(MemoryStreamAdapter).GetMethod("GetMemoryStream", Globals.ScanAllMembers); 1011s_getMemoryStreamAdapterMethod = typeof(MemoryStreamAdapter).GetMethod("GetMemoryStreamAdapter", Globals.ScanAllMembers); 1053s_throwInvalidDataContractExceptionMethod = typeof(DataContract).GetMethod("ThrowInvalidDataContractException", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(Type) }); 1067s_serializeReadOnlyTypesProperty = typeof(XmlObjectSerializerWriteContext).GetProperty("SerializeReadOnlyTypes", Globals.ScanAllMembers); 1081s_classSerializationExceptionMessageProperty = typeof(ClassDataContract).GetProperty("SerializationExceptionMessage", Globals.ScanAllMembers); 1095s_collectionSerializationExceptionMessageProperty = typeof(CollectionDataContract).GetProperty("SerializationExceptionMessage", Globals.ScanAllMembers);
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (43)
92_ilg.BeginMethod("Read" + classContract.XmlName.Name + "FromXml", Globals.TypeOfXmlFormatClassReaderDelegate, memberAccessFlag); 113objectId = _ilg.DeclareLocal(Globals.TypeOfString); 128if (Globals.TypeOfIDeserializationCallback.IsAssignableFrom(classContract.UnderlyingType)) 142if (classContract.UnderlyingType == Globals.TypeOfDateTimeOffsetAdapter) 144_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfDateTimeOffsetAdapter); 146_ilg.ConvertValue(Globals.TypeOfDateTimeOffset, _ilg.CurrentMethod.ReturnType); 148else if (classContract.UnderlyingType == Globals.TypeOfMemoryStreamAdapter) 150_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfMemoryStreamAdapter); 152_ilg.ConvertValue(Globals.TypeOfMemoryStream, _ilg.CurrentMethod.ReturnType); 220_ilg.BeginMethod("Read" + collectionContract.XmlName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag); 224_ilg.BeginMethod("Read" + collectionContract.XmlName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag); 258type = Globals.TypeOfValueType; 262if (classContract.UnderlyingType == Globals.TypeOfDBNull) 283_ilg.ConvertValue(Globals.TypeOfObject, type); 326return Globals.TypeOfIObjectReference.IsAssignableFrom(classContract.UnderlyingType); 337_ilg.ConvertAddress(_objectLocal.LocalType, Globals.TypeOfIObjectReference); 340_ilg.ConvertValue(Globals.TypeOfObject, _ilg.CurrentMethod.ReturnType); 353LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 380LocalBuilder memberIndexLocal = _ilg.DeclareLocal(Globals.TypeOfInt, -1); 385LocalBuilder? requiredIndexLocal = hasRequiredMembers ? _ilg.DeclareLocal(Globals.TypeOfInt, firstRequiredMember) : null; 509while (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) 516if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 518LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 523_ilg.If(objectId, Cmp.EqualTo, Globals.NullObjectId); 555if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 573_ilg.ConvertValue(Globals.TypeOfObject, type); 580_ilg.If(objectId, Cmp.NotEqualTo, Globals.NullObjectId); 599Type declaredType = type.IsPointer ? Globals.TypeOfReflectionPointer : type; 609_ilg.ConvertValue(Globals.TypeOfObject, type); 623Type type = Globals.TypeOfNullable.MakeGenericType(innerType); 646type = Globals.TypeOfDictionaryGeneric.MakeGenericType(itemType.GetGenericArguments()); 650type = Globals.TypeOfHashtable; 683LocalBuilder size = _ilg.DeclareLocal(Globals.TypeOfInt); 687LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 707LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 749LocalBuilder j = _ilg.DeclareLocal(Globals.TypeOfInt); 786_ilg.ConvertValue(Globals.TypeOfObject, type); 796LocalBuilder size = _ilg.DeclareLocal(Globals.TypeOfInt); 806LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 882_ilg.Call(typeof(XmlReaderDelegator).GetMethod(readArrayMethod, Globals.ScanAllMembers)!); 901_ilg.ConvertValue(Globals.TypeOfObject, itemType); 936if (collectionContract.AddMethod.ReturnType != Globals.TypeOfVoid) 942if (collectionContract.AddMethod.ReturnType != Globals.TypeOfVoid)
System\Runtime\Serialization\XmlFormatWriterGenerator.cs (40)
86_ilg.BeginMethod("Write" + classContract.XmlName.Name + "ToXml", Globals.TypeOfXmlFormatClassWriterDelegate, memberAccessFlag); 130_ilg.BeginMethod("Write" + collectionContract.XmlName.Name + "ToXml", Globals.TypeOfXmlFormatCollectionWriterDelegate, memberAccessFlag); 168if (objType == Globals.TypeOfDateTimeOffsetAdapter) 170_ilg.ConvertValue(objectArg.ArgType, Globals.TypeOfDateTimeOffset); 173else if (objType == Globals.TypeOfMemoryStreamAdapter) 175_ilg.ConvertValue(objectArg.ArgType, Globals.TypeOfMemoryStream); 271LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 273_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfIExtensibleDataObject); 397LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 433incrementCollectionCountMethod = XmlFormatGeneratorStatics.IncrementCollectionCountGenericMethod.MakeGenericMethod(Globals.TypeOfKeyValuePair.MakeGenericType(collectionContract.ItemType.GetGenericArguments())); 448enumeratorType = Globals.TypeOfGenericDictionaryEnumerator.MakeGenericType(keyValueTypes); 453keyValueTypes = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject }; 454enumeratorType = Globals.TypeOfDictionaryEnumerator; 460MethodInfo? moveNextMethod = enumeratorType.GetMethod(Globals.MoveNextMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes); 461MethodInfo? getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes); 471Type ienumeratorInterface = Globals.TypeOfIEnumerator; 479&& interfaceType.GetGenericTypeDefinition() == Globals.TypeOfIEnumeratorGeneric 488moveNextMethod ??= CollectionDataContract.GetTargetMethodWithName(Globals.MoveNextMethodName, enumeratorType, ienumeratorInterface)!; 489getCurrentMethod ??= CollectionDataContract.GetTargetMethodWithName(Globals.GetCurrentMethodName, enumeratorType, ienumeratorInterface)!; 499_ilg.ConvertValue(collectionContract.GetEnumeratorMethod.ReturnType, Globals.TypeOfIDictionaryEnumerator); 504Type ctorParam = Globals.TypeOfIEnumeratorGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(keyValueTypes!)); 505ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { ctorParam })!; 525_ilg.ConvertValue(currentValue.LocalType, Globals.TypeOfObject); 544if (primitiveContract == null || primitiveContract.UnderlyingType == Globals.TypeOfObject) 628_ilg.Call(typeof(XmlWriterDelegator).GetMethod(writeArrayMethod, Globals.ScanAllMembers, new Type[] { type, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!); 644memberType = Globals.TypeOfReflectionPointer; 649memberType.GetGenericTypeDefinition() == Globals.TypeOfNullable); 675if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject && !writeXsiType) 688if (memberType == Globals.TypeOfObject ||//boxed Nullable<T> 689memberType == Globals.TypeOfValueType || 690((IList)Globals.TypeOfNullable.GetInterfaces()).Contains(memberType)) 693_ilg.ConvertValue(memberValue.LocalType, Globals.TypeOfObject); 694memberValue = _ilg.DeclareLocal(Globals.TypeOfObject); 704if (memberType == Globals.TypeOfObject) //boxed Nullable<T> 716_ilg.ConvertValue(memberValue.LocalType, Globals.TypeOfObject); 738while (memberType.IsGenericType && memberType.GetGenericTypeDefinition() == Globals.TypeOfNullable) 762return type == Globals.TypeOfXmlQualifiedName && (ns != null && ns.Value != null && ns.Value.Length > 0); 771_ilg.Load(Globals.ElementPrefix);
System\Runtime\Serialization\XmlObjectSerializer.cs (2)
259writer.WriteAttributeBool(Globals.XsiPrefix, DictionaryGlobals.XsiNilLocalName, DictionaryGlobals.SchemaInstanceNamespace, true); 426DataContract objectContract = PrimitiveDataContract.GetPrimitiveDataContract(Globals.TypeOfObject)!;
System\Runtime\Serialization\XmlObjectSerializerReadContext.cs (22)
117if (attributes.Ref != Globals.NewObjectId) 121throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.ErrorDeserializing, SR.Format(SR.ErrorTypeInfo, DataContract.GetClrTypeFullName(declaredType)), SR.Format(SR.XmlStartElementExpected, Globals.RefLocalName))); 298if (attributes.Ref != Globals.NewObjectId) 308return Globals.NullObjectId; 310return Globals.NewObjectId; 346if (id != Globals.NewObjectId) 357if (id != Globals.NewObjectId) 520if (xmlDataContract.UnderlyingType == Globals.TypeOfXmlElement) 527else if (xmlDataContract.UnderlyingType == Globals.TypeOfXmlNodeArray) 567if (attributes.Ref != Globals.NewObjectId) 579value = InternalDeserialize(xmlReader, Globals.TypeOfObject, name, string.Empty); 617if (attributes.Ref != Globals.NewObjectId) 671if (attributes.Id == Globals.NewObjectId) 729if (xmlReader.NamespaceURI.StartsWith(Globals.DataContractXsdBaseNamespace, StringComparison.Ordinal)) 737IDataNode objNode = ReadUnknownPrimitiveData(xmlReader, Globals.TypeOfObject, dataContractName, dataContractNamespace); 750if (valueType == Globals.TypeOfString) 915if (ns != Globals.SerializationNamespace && ns != Globals.SchemaInstanceNamespace) 1074Document.CreateAttribute(null, Globals.XmlnsPrefix, Globals.XmlnsNamespace) : 1075Document.CreateAttribute(Globals.XmlnsPrefix, prefix, Globals.XmlnsNamespace);
System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (18)
99Type declaredType = Globals.TypeOfObject; 219xmlWriter.WriteAttributeString(Globals.SerPrefix, DictionaryGlobals.IdLocalName, 225xmlWriter.WriteAttributeString(Globals.SerPrefix, DictionaryGlobals.RefLocalName, DictionaryGlobals.SerializationNamespace, string.Create(CultureInfo.InvariantCulture, $"i{objectId}")); 357xmlWriter.WriteStartElement(Globals.ElementPrefix, name, ns); 367writer.WriteXmlnsAttribute(Globals.XsiPrefix, DictionaryGlobals.SchemaInstanceNamespace); 370writer.WriteXmlnsAttribute(Globals.XsdPrefix, DictionaryGlobals.SchemaNamespace); 544xmlWriter.WriteAttributeQualifiedName(Globals.SerPrefix, DictionaryGlobals.ISerializableFactoryTypeLocalName, DictionaryGlobals.SerializationNamespace, typeName, typeNs); 551xmlWriter.WriteAttributeQualifiedName(Globals.SerPrefix, DictionaryGlobals.ISerializableFactoryTypeLocalName, DictionaryGlobals.SerializationNamespace, DataContract.GetClrTypeString(typeName), DataContract.GetClrTypeString(typeNs)); 568InternalSerializeReference(xmlWriter, obj, false /*isDeclaredType*/, false /*writeXsiType*/, -1, Globals.TypeOfObject.TypeHandle); 648writer.WriteAttributeQualifiedName(Globals.XsiPrefix, DictionaryGlobals.XsiTypeLocalName, DictionaryGlobals.SchemaInstanceNamespace, dataContractName, dataContractNamespace); 653writer.WriteAttributeQualifiedName(Globals.XsiPrefix, DictionaryGlobals.XsiTypeLocalName, DictionaryGlobals.SchemaInstanceNamespace, dataContractName, dataContractNamespace); 713if (dataType == Globals.TypeOfClassDataNode) 715else if (dataType == Globals.TypeOfCollectionDataNode) 717else if (dataType == Globals.TypeOfXmlDataNode) 719else if (dataType == Globals.TypeOfISerializableDataNode) 725if (dataType == Globals.TypeOfObject) 748Type declaredType = (dataNode.DataContractName == null) ? o.GetType() : Globals.TypeOfObject; 804xmlWriter.WriteAttributeQualifiedName(Globals.SerPrefix, DictionaryGlobals.ISerializableFactoryTypeLocalName, DictionaryGlobals.SerializationNamespace, dataNode.FactoryTypeName, dataNode.FactoryTypeNamespace);
System\Runtime\Serialization\XmlObjectSerializerWriteContextComplex.cs (6)
130xmlWriter.WriteStartElement(Globals.ElementPrefix, name, ns); 160xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.IdLocalName, DictionaryGlobals.SerializationNamespace, objectId); 163xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.RefLocalName, DictionaryGlobals.SerializationNamespace, objectId); 164xmlWriter.WriteAttributeBool(Globals.XsiPrefix, DictionaryGlobals.XsiNilLocalName, DictionaryGlobals.SchemaInstanceNamespace, true); 238declaredType = Globals.TypeOfObject; 257xmlWriter.WriteAttributeInt(Globals.SerPrefix, DictionaryGlobals.ArraySizeLocalName, DictionaryGlobals.SerializationNamespace, size);
System\Runtime\Serialization\XmlReaderDelegator.cs (12)
263if (valueType == Globals.TypeOfByteArray) 265else if (valueType == Globals.TypeOfObject) 267else if (valueType == Globals.TypeOfTimeSpan) 269else if (valueType == Globals.TypeOfGuid) 271else if (valueType == Globals.TypeOfUri) 273else if (valueType == Globals.TypeOfXmlQualifiedName) 318if (valueType == Globals.TypeOfByteArray) 320else if (valueType == Globals.TypeOfObject) 322else if (valueType == Globals.TypeOfTimeSpan) 324else if (valueType == Globals.TypeOfGuid) 326else if (valueType == Globals.TypeOfUri) 328else if (valueType == Globals.TypeOfXmlQualifiedName)
System\Runtime\Serialization\XmlSerializableServices.cs (2)
49return xmlReader.NamespaceURI != Globals.SerializationNamespace && 50xmlReader.NamespaceURI != Globals.SchemaInstanceNamespace &&
System\Runtime\Serialization\XmlWriterDelegator.cs (12)
336if (valueType == Globals.TypeOfByteArray) 338else if (valueType == Globals.TypeOfObject) 342else if (valueType == Globals.TypeOfTimeSpan) 344else if (valueType == Globals.TypeOfGuid) 346else if (valueType == Globals.TypeOfUri) 348else if (valueType == Globals.TypeOfXmlQualifiedName) 413if (valueType == Globals.TypeOfByteArray) 415else if (valueType == Globals.TypeOfObject) 421else if (valueType == Globals.TypeOfTimeSpan) 423else if (valueType == Globals.TypeOfGuid) 425else if (valueType == Globals.TypeOfUri) 427else if (valueType == Globals.TypeOfXmlQualifiedName)