202 references to UnderlyingType
System.Private.DataContractSerialization (197)
System\Runtime\Serialization\ClassDataContract.cs (24)
159private Func<object> MakeNewInstance => _makeNewInstance ??= FastInvokerBuilder.GetMakeNewInstanceFunc(UnderlyingType); 166if (ci == null || UnderlyingType == Globals.TypeOfSchemaDefinedType) 189Debug.Assert(UnderlyingType != Globals.TypeOfSchemaDefinedType); 219Debug.Assert(UnderlyingType != Globals.TypeOfSchemaDefinedType); 407if (!IsTypeVisible(UnderlyingType)) 413DataContract.GetClrTypeFullName(UnderlyingType)), 427DataContract.GetClrTypeFullName(UnderlyingType)), 439DataContract.GetClrTypeFullName(UnderlyingType)), 451DataContract.GetClrTypeFullName(UnderlyingType), 464DataContract.GetClrTypeFullName(UnderlyingType), 483DataContract.GetClrTypeFullName(UnderlyingType), 491DataContract.GetClrTypeFullName(UnderlyingType), 513if (!IsTypeVisible(UnderlyingType)) 519DataContract.GetClrTypeFullName(UnderlyingType)), 534DataContract.GetClrTypeFullName(UnderlyingType), 547DataContract.GetClrTypeFullName(UnderlyingType), 566DataContract.GetClrTypeFullName(UnderlyingType), 574DataContract.GetClrTypeFullName(UnderlyingType), 761DataContract.GetClrTypeFullName(BaseClassContract.UnderlyingType), 1316Type type = UnderlyingType; 1338underlyingParamTypes[i] = paramContracts[i].UnderlyingType; 1353paramTypes[i] = paramContracts[paramType.GenericParameterPosition].UnderlyingType; 1365boundClassContract.XmlName = CreateQualifiedName(DataContract.ExpandGenericParameters(XmlConvert.DecodeName(xmlName.Name), new GenericNameProvider(DataContract.GetClrTypeFullName(UnderlyingType), genericParams)), xmlName.Namespace); 1504Type type = UnderlyingType;
System\Runtime\Serialization\CollectionDataContract.cs (14)
353if (UnderlyingType.IsInterface && (Kind == CollectionKind.Enumerable || Kind == CollectionKind.Collection || Kind == CollectionKind.GenericEnumerable)) 355throw new InvalidDataContractException(SR.Format(SR.GetOnlyCollectionMustHaveAddMethod, GetClrTypeFullName(UnderlyingType))); 365throw new InvalidDataContractException(SR.Format(SR.GetOnlyCollectionMustHaveAddMethod, GetClrTypeFullName(UnderlyingType))); 1388Type type = UnderlyingType; 1393paramTypes[i] = paramContracts[paramTypes[i].GenericParameterPosition].UnderlyingType; 1405boundCollectionContract.XmlName = CreateQualifiedName(DataContract.ExpandGenericParameters(XmlConvert.DecodeName(XmlName.Name), new GenericNameProvider(DataContract.GetClrTypeFullName(UnderlyingType), paramContracts)), 1406IsCollectionDataContract(UnderlyingType) ? XmlName.Namespace : DataContract.GetCollectionNamespace(boundCollectionContract.ItemContract.XmlName.Namespace)); 1427throw new InvalidDataContractException(SR.Format(SR.CollectionTypeDoesNotHaveDefaultCtor, DataContract.GetClrTypeFullName(UnderlyingType))); 1447if (!IsTypeVisible(UnderlyingType)) 1453DataContract.GetClrTypeFullName(UnderlyingType)), 1475DataContract.GetClrTypeFullName(UnderlyingType)), 1486DataContract.GetClrTypeFullName(UnderlyingType), 1503if (!IsTypeVisible(UnderlyingType)) 1509DataContract.GetClrTypeFullName(UnderlyingType)),
System\Runtime\Serialization\ContextAware.cs (2)
32AssemblyLoadContext? alc = AssemblyLoadContext.GetLoadContext(dataContract.UnderlyingType.Assembly); 40_keepAlive.Add(dataContract.UnderlyingType, dataContract);
System\Runtime\Serialization\DataContract.cs (9)
92throw new SerializationException(SR.Format(SR.ErrorDeserializing, SR.Format(SR.ErrorTypeInfo, DataContract.GetClrTypeFullName(dataContract.UnderlyingType)), SR.Format(SR.NoSetMethodForProperty, string.Empty, string.Empty))); 171throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType))); 178throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType))); 185throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType))); 190throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType))); 388return (cachedContract != null && cachedContract.UnderlyingType == contract.UnderlyingType); 2060if (DataContractCriticalHelper.GetDataContractAdapterType(alreadyExistingContract.UnderlyingType) != DataContractCriticalHelper.GetDataContractAdapterType(type)) 2061throw new InvalidOperationException(SR.Format(SR.DupContractInKnownTypes, type, alreadyExistingContract.UnderlyingType, dataContract.XmlName.Namespace, dataContract.XmlName.Name));
System\Runtime\Serialization\DataContractSerializer.cs (3)
373Type declaredType = contract.UnderlyingType; 408throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.IsAnyCannotBeSerializedAsDerivedType, graphType, contract.UnderlyingType)); 491if (contract.IsPrimitive && object.ReferenceEquals(contract.UnderlyingType, _rootType) /*handle Nullable<T> differently*/)
System\Runtime\Serialization\DataContractSet.cs (11)
83EnsureTypeNotGeneric(dataContract.UnderlyingType); 111if (dataContract.UnderlyingType == null || dataContractInSet.UnderlyingType == null) 115bool typeNamesEqual = (DataContract.GetClrTypeFullName(dataContract.UnderlyingType) == DataContract.GetClrTypeFullName(dataContractInSet.UnderlyingType)); 116throw new InvalidOperationException(SR.Format(SR.DupTypeContractInDataContractSet, (typeNamesEqual ? dataContract.UnderlyingType.AssemblyQualifiedName : DataContract.GetClrTypeFullName(dataContract.UnderlyingType)), (typeNamesEqual ? dataContractInSet.UnderlyingType.AssemblyQualifiedName : DataContract.GetClrTypeFullName(dataContractInSet.UnderlyingType)), dataContract.XmlName.Name, dataContract.XmlName.Namespace)); 161memberDataContract.UnderlyingType); 177if (collectionDataContract.UnderlyingType != Globals.TypeOfSchemaDefinedType)
System\Runtime\Serialization\DataMember.cs (1)
126_memberInfo = memberTypeContract.UnderlyingType;
System\Runtime\Serialization\EnumDataContract.cs (6)
321throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.InvalidEnumValueOnWrite, value, DataContract.GetClrTypeFullName(UnderlyingType))); 327throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.InvalidEnumValueOnWrite, value, DataContract.GetClrTypeFullName(UnderlyingType))); 367throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.InvalidEnumValueOnRead, stringValue, DataContract.GetClrTypeFullName(UnderlyingType))); 372return Enum.ToObject(UnderlyingType, (object)(ulong)longValue); 373return Enum.ToObject(UnderlyingType, (object)longValue); 386throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.InvalidEnumValueOnRead, value.Substring(index, count), DataContract.GetClrTypeFullName(UnderlyingType)));
System\Runtime\Serialization\Json\DataContractJsonSerializer.cs (3)
462if (contract.IsPrimitive && object.ReferenceEquals(contract.UnderlyingType, _rootType))// handle Nullable<T> differently 497Type declaredType = contract.UnderlyingType; 635DataContract.GetClrTypeFullName(dataContract.UnderlyingType),
System\Runtime\Serialization\Json\JsonClassDataContract.cs (1)
164throw new SerializationException(SR.Format(SR.JsonDuplicateMemberNames, DataContract.GetClrTypeFullName(_traditionalClassDataContract.UnderlyingType), _traditionalClassDataContract.MemberNames[i].Value));
System\Runtime\Serialization\Json\JsonCollectionDataContract.cs (2)
70if (this.TraditionalDataContract.UnderlyingType.IsInterface && (kind == CollectionKind.Enumerable || kind == CollectionKind.Collection || kind == CollectionKind.GenericEnumerable)) 72throw new InvalidDataContractException(SR.Format(SR.GetOnlyCollectionMustHaveAddMethod, DataContract.GetClrTypeFullName(this.TraditionalDataContract.UnderlyingType)));
System\Runtime\Serialization\Json\JsonDataContract.cs (4)
56throw new InvalidDataContractException(SR.Format(SR.SerializationCodeIsMissingForType, c.UnderlyingType)); 179int id = JsonDataContractCriticalHelper.GetId(traditionalDataContract.UnderlyingType.TypeHandle); 245traditionalDataContract.UnderlyingType == Globals.TypeOfXmlQualifiedName) 272throw new ArgumentException(SR.Format(SR.JsonTypeNotSupportedByDataContractJsonSerializer, traditionalDataContract.UnderlyingType), nameof(traditionalDataContract));
System\Runtime\Serialization\Json\JsonEnumDataContract.cs (2)
30enumValue = Enum.ToObject(TraditionalDataContract.UnderlyingType, jsonReader.ReadElementContentAsUnsignedLong()); 34enumValue = Enum.ToObject(TraditionalDataContract.UnderlyingType, jsonReader.ReadElementContentAsLong());
System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs (14)
92if (Globals.TypeOfIDeserializationCallback.IsAssignableFrom(classContract.UnderlyingType)) 105if (classContract.UnderlyingType == Globals.TypeOfDateTimeOffsetAdapter) 111else if (classContract.UnderlyingType == Globals.TypeOfMemoryStreamAdapter) 201_objectType = classContract.UnderlyingType; 206if (classContract.UnderlyingType == Globals.TypeOfDBNull) 262return Globals.TypeOfIObjectReference.IsAssignableFrom(classContract.UnderlyingType); 454ConstructorInfo? ctor = classContract.UnderlyingType.GetConstructor(Globals.ScanAllMembers, JsonFormatGeneratorStatics.SerInfoCtorArgs); 456throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.SerializationInfo_ConstructorNotFound, DataContract.GetClrTypeFullName(classContract.UnderlyingType))); 459_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType); 479if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 518if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 601Type type = collectionContract.UnderlyingType; 763DataContract.GetClrTypeFullName(collectionContract.UnderlyingType), 822Type type = collectionContract.UnderlyingType;
System\Runtime\Serialization\Json\JsonFormatWriterGenerator.cs (6)
76InitArgs(classContract.UnderlyingType); 103InitArgs(collectionContract.UnderlyingType); 286_ilg.Call(thisObj: null, XmlFormatGeneratorStatics.ThrowRequiredMemberMustBeEmittedMethod, member.Name, classContract.UnderlyingType); 321if (!TryWritePrimitiveArray(collectionContract.UnderlyingType, itemType, _objectLocal, itemName)) 511if (primitiveContract == null || primitiveContract.UnderlyingType == Globals.TypeOfObject) 662if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject)
System\Runtime\Serialization\Json\JsonXmlDataContract.cs (2)
30DataContractSerializer dataContractSerializer = new DataContractSerializer(TraditionalDataContract.UnderlyingType, 81knownTypesList.Add(pair.Value.UnderlyingType);
System\Runtime\Serialization\Json\ReflectionJsonFormatReader.cs (2)
182DataContract.GetClrTypeFullName(collectionContract.UnderlyingType), 209TypeCode typeCode = Type.GetTypeCode(keyDataContract.UnderlyingType);
System\Runtime\Serialization\Json\ReflectionJsonFormatWriter.cs (3)
89PrimitiveDataContract? primitiveContractForType = PrimitiveDataContract.GetPrimitiveDataContract(collectionContract.UnderlyingType); 90if (primitiveContractForType != null && primitiveContractForType.UnderlyingType != Globals.TypeOfObject) 239XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted(member.Name, classContract.UnderlyingType);
System\Runtime\Serialization\Json\XmlObjectSerializerWriteContextComplexJson.cs (9)
104(contract.UnderlyingType != Globals.TypeOfObjectArray) && 124if (declaredContract.UnderlyingType == typeof(Enum)) 126throw new SerializationException(SR.Format(SR.EnumTypeNotSupportedByDataContractJsonSerializer, declaredContract.UnderlyingType)); 208if ((declaredType != dataContract.UnderlyingType) && (dataContract is CollectionDataContract)) 245Type declaredType = rootTypeDataContract!.UnderlyingType; 275throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.DcTypeNotFoundOnSerialize, DataContract.GetClrTypeFullName(dataContract.UnderlyingType), dataContract.XmlName.Name, dataContract.XmlName.Namespace)); 359oldItemContract.UnderlyingType.IsGenericType && 360(oldItemContract.UnderlyingType.GetGenericTypeDefinition() == Globals.TypeOfKeyValue)) 362return DataContract.GetDataContract(oldItemContract.UnderlyingType);
System\Runtime\Serialization\PrimitiveDataContract.cs (6)
69if (UnderlyingType.IsValueType) 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) })!; 85if (UnderlyingType.IsValueType) 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 })!;
System\Runtime\Serialization\ReflectionClassWriter.cs (2)
88if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject && !writeXsiType) 122if (primitiveContract == null || primitiveContract.UnderlyingType == Globals.TypeOfObject)
System\Runtime\Serialization\ReflectionReader.cs (13)
82XmlObjectSerializerReadContext.ThrowNullValueReturnedForGetOnlyCollectionException(collectionContract.UnderlyingType); 263if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 294if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 335SerializationInfo serializationInfo = context.ReadSerializationInfo(xmlReader, classContract.UnderlyingType); 355if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 432Type classType = classContract.UnderlyingType; 455if (collectionContract.UnderlyingType.IsInterface) 487else if (collectionContract.Kind == CollectionKind.GenericDictionary && collectionContract.UnderlyingType.IsInterface) 496if (collectionContract.UnderlyingType.IsValueType) 498object newValueObject = Activator.CreateInstance(collectionContract.UnderlyingType)!; 501else if (collectionContract.UnderlyingType == Globals.TypeOfIDictionary) 535XmlObjectSerializerReadContext.ThrowArrayExceededSizeException(arraySize, collectionContract.UnderlyingType); 608throw new InvalidDataContractException(SR.Format(SR.CollectionMustHaveAddMethod, DataContract.GetClrTypeFullName(collectionContract.UnderlyingType)));
System\Runtime\Serialization\ReflectionXmlFormatWriter.cs (3)
59PrimitiveDataContract? primitiveContractForType = PrimitiveDataContract.GetPrimitiveDataContract(collectionDataContract.UnderlyingType); 61if (primitiveContractForType != null && primitiveContractForType.UnderlyingType != Globals.TypeOfObject) 173XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted(member.Name, classContract.UnderlyingType);
System\Runtime\Serialization\SchemaExporter.cs (8)
125if (classDataContract.UnderlyingType.IsGenericType) 126genericInfoElement = ExportGenericInfo(classDataContract.UnderlyingType, Globals.GenericTypeLocalName, Globals.SerializationNamespace); 367if (collectionDataContract.UnderlyingType.IsGenericType && CollectionDataContract.IsCollectionDataContract(collectionDataContract.UnderlyingType)) 368genericInfoElement = ExportGenericInfo(collectionDataContract.UnderlyingType, Globals.GenericTypeLocalName, Globals.SerializationNamespace); 470if (dataContract.UnderlyingType.IsGenericType) 471genericInfoElement = ExportGenericInfo(dataContract.UnderlyingType, Globals.GenericTypeLocalName, Globals.SerializationNamespace); 511Type clrType = dataContract.UnderlyingType;
System\Runtime\Serialization\SchemaImporter.cs (1)
207return dataContract is PrimitiveDataContract && ((PrimitiveDataContract)dataContract).UnderlyingType == Globals.TypeOfObject;
System\Runtime\Serialization\XmlDataContract.cs (11)
115return () => ReflectionCreateXmlSerializable(this.UnderlyingType); 121public override bool IsBuiltInDataContract => UnderlyingType == Globals.TypeOfXmlElement || UnderlyingType == Globals.TypeOfXmlNodeArray; 249if (UnderlyingType.IsValueType) 252ConstructorInfo? ctor = UnderlyingType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, Type.EmptyTypes); 254throw new InvalidDataContractException(SR.Format(SR.IXmlSerializableMustHaveDefaultConstructor, DataContract.GetClrTypeFullName(UnderlyingType))); 273Type type = this.UnderlyingType; 327ilg.ConvertValue(this.UnderlyingType, Globals.TypeOfIXmlSerializable); 339if (!IsTypeVisible(UnderlyingType)) 343throw new SecurityException(SR.Format(SR.PartialTrustIXmlSerializableTypeNotPublic, DataContract.GetClrTypeFullName(UnderlyingType)), 353throw new SecurityException(SR.Format(SR.PartialTrustIXmlSerialzableNoPublicConstructor, DataContract.GetClrTypeFullName(UnderlyingType)),
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (11)
128if (Globals.TypeOfIDeserializationCallback.IsAssignableFrom(classContract.UnderlyingType)) 142if (classContract.UnderlyingType == Globals.TypeOfDateTimeOffsetAdapter) 148else if (classContract.UnderlyingType == Globals.TypeOfMemoryStreamAdapter) 256Type type = _objectType = classContract.UnderlyingType; 262if (classContract.UnderlyingType == Globals.TypeOfDBNull) 326return Globals.TypeOfIObjectReference.IsAssignableFrom(classContract.UnderlyingType); 496_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType); 516if ((primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) || nullables != 0 || type.IsValueType) 555if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject) 635Type type = collectionContract.UnderlyingType; 777Type type = collectionContract.UnderlyingType;
System\Runtime\Serialization\XmlFormatWriterGenerator.cs (6)
99InitArgs(classContract.UnderlyingType); 143InitArgs(collectionContract.UnderlyingType); 352_ilg.Call(thisObj: null, XmlFormatGeneratorStatics.ThrowRequiredMemberMustBeEmittedMethod, member.Name, classContract.UnderlyingType); 401if (!TryWritePrimitiveArray(collectionContract.UnderlyingType, itemType, _objectLocal, itemName, itemNamespace)) 544if (primitiveContract == null || primitiveContract.UnderlyingType == Globals.TypeOfObject) 675if (primitiveContract != null && primitiveContract.UnderlyingType != Globals.TypeOfObject && !writeXsiType)
System\Runtime\Serialization\XmlObjectSerializerContext.cs (3)
231return knownContract != null && knownContract.UnderlyingType == dataContract.UnderlyingType; 267&& !memberTypeContract.UnderlyingType.IsInterface
System\Runtime\Serialization\XmlObjectSerializerReadContext.cs (7)
143if (TryHandleNullOrRef(reader, name, ns, dataContract.UnderlyingType, ref retObj)) 182throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.FactoryTypeNotISerializable, DataContract.GetClrTypeFullName(factoryDataContract.UnderlyingType), DataContract.GetClrTypeFullName(dataContract.UnderlyingType))); 520if (xmlDataContract.UnderlyingType == Globals.TypeOfXmlElement) 527else if (xmlDataContract.UnderlyingType == Globals.TypeOfXmlNodeArray) 675dataNode = ReadUnknownPrimitiveData(xmlReader, dataContract.UnderlyingType, dataContractName, dataContractNamespace); 680dataNode = new DataNode<object>(xmlReader.ReadElementContentAsAnyType(dataContract.UnderlyingType));
System\Runtime\Serialization\XmlObjectSerializerReadContextComplex.cs (2)
67if (this.IsGetOnlyCollection && dataContract.UnderlyingType != declaredType) 74object? obj = DataContractSurrogateCaller.GetDeserializedObject(_serializationSurrogateProvider, oldObj, dataContract.UnderlyingType, declaredType);
System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (3)
246if (knownContract == null || knownContract.UnderlyingType != dataContract.UnderlyingType) 248throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.DcTypeNotFoundOnSerialize, DataContract.GetClrTypeFullName(dataContract.UnderlyingType), dataContract.XmlName.Name, dataContract.XmlName.Namespace));
System\Runtime\Serialization\XsdDataContractExporter.cs (3)
195EnsureTypeNotGeneric(dataContract.UnderlyingType); 214EnsureTypeNotGeneric(dataContract.UnderlyingType); 233EnsureTypeNotGeneric(dataContract.UnderlyingType);
System.Runtime.Serialization.Schema (5)
System\Runtime\Serialization\Schema\CodeExporter.cs (4)
238throw ExceptionUtil.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, GetClrTypeFullName(dataContract.GetType()), GetClrTypeFullName(dataContract.UnderlyingType)))); 308return GetCodeTypeReference(dataContract.UnderlyingType); 1071Type baseType = enumDataContract.BaseContract!.UnderlyingType; 1632return dataContract != null && dataContract.Is(DataContractType.PrimitiveDataContract) && dataContract.UnderlyingType == typeof(object);
System\Runtime\Serialization\Schema\SchemaImportHelper.cs (1)
50return SchemaImportHelper.IsTypeNullable(collectionDataContract.BaseContract!.UnderlyingType);