202 references to UnderlyingType
System.Private.DataContractSerialization (197)
System\Runtime\Serialization\ClassDataContract.cs (24)
160private Func<object> MakeNewInstance => _makeNewInstance ??= FastInvokerBuilder.GetMakeNewInstanceFunc(UnderlyingType); 167if (ci == null || UnderlyingType == Globals.TypeOfSchemaDefinedType) 190Debug.Assert(UnderlyingType != Globals.TypeOfSchemaDefinedType); 220Debug.Assert(UnderlyingType != Globals.TypeOfSchemaDefinedType); 408if (!IsTypeVisible(UnderlyingType)) 414DataContract.GetClrTypeFullName(UnderlyingType)), 428DataContract.GetClrTypeFullName(UnderlyingType)), 440DataContract.GetClrTypeFullName(UnderlyingType)), 452DataContract.GetClrTypeFullName(UnderlyingType), 465DataContract.GetClrTypeFullName(UnderlyingType), 484DataContract.GetClrTypeFullName(UnderlyingType), 492DataContract.GetClrTypeFullName(UnderlyingType), 514if (!IsTypeVisible(UnderlyingType)) 520DataContract.GetClrTypeFullName(UnderlyingType)), 535DataContract.GetClrTypeFullName(UnderlyingType), 548DataContract.GetClrTypeFullName(UnderlyingType), 567DataContract.GetClrTypeFullName(UnderlyingType), 575DataContract.GetClrTypeFullName(UnderlyingType), 764DataContract.GetClrTypeFullName(BaseClassContract.UnderlyingType), 1319Type type = UnderlyingType; 1341underlyingParamTypes[i] = paramContracts[i].UnderlyingType; 1356paramTypes[i] = paramContracts[paramType.GenericParameterPosition].UnderlyingType; 1368boundClassContract.XmlName = CreateQualifiedName(DataContract.ExpandGenericParameters(XmlConvert.DecodeName(xmlName.Name), new GenericNameProvider(DataContract.GetClrTypeFullName(UnderlyingType), genericParams)), xmlName.Namespace); 1507Type type = UnderlyingType;
System\Runtime\Serialization\CollectionDataContract.cs (14)
354if (UnderlyingType.IsInterface && (Kind == CollectionKind.Enumerable || Kind == CollectionKind.Collection || Kind == CollectionKind.GenericEnumerable)) 356throw new InvalidDataContractException(SR.Format(SR.GetOnlyCollectionMustHaveAddMethod, GetClrTypeFullName(UnderlyingType))); 366throw new InvalidDataContractException(SR.Format(SR.GetOnlyCollectionMustHaveAddMethod, GetClrTypeFullName(UnderlyingType))); 1392Type type = UnderlyingType; 1397paramTypes[i] = paramContracts[paramTypes[i].GenericParameterPosition].UnderlyingType; 1409boundCollectionContract.XmlName = CreateQualifiedName(DataContract.ExpandGenericParameters(XmlConvert.DecodeName(XmlName.Name), new GenericNameProvider(DataContract.GetClrTypeFullName(UnderlyingType), paramContracts)), 1410IsCollectionDataContract(UnderlyingType) ? XmlName.Namespace : DataContract.GetCollectionNamespace(boundCollectionContract.ItemContract.XmlName.Namespace)); 1431throw new InvalidDataContractException(SR.Format(SR.CollectionTypeDoesNotHaveDefaultCtor, DataContract.GetClrTypeFullName(UnderlyingType))); 1451if (!IsTypeVisible(UnderlyingType)) 1457DataContract.GetClrTypeFullName(UnderlyingType)), 1479DataContract.GetClrTypeFullName(UnderlyingType)), 1490DataContract.GetClrTypeFullName(UnderlyingType), 1507if (!IsTypeVisible(UnderlyingType)) 1513DataContract.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)
99throw new SerializationException(SR.Format(SR.ErrorDeserializing, SR.Format(SR.ErrorTypeInfo, DataContract.GetClrTypeFullName(dataContract.UnderlyingType)), SR.Format(SR.NoSetMethodForProperty, string.Empty, string.Empty))); 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))); 192throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType))); 197throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType))); 406return (cachedContract != null && cachedContract.UnderlyingType == contract.UnderlyingType); 2086if (DataContractCriticalHelper.GetDataContractAdapterType(alreadyExistingContract.UnderlyingType) != DataContractCriticalHelper.GetDataContractAdapterType(type)) 2087throw 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)
123_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)
471if (contract.IsPrimitive && object.ReferenceEquals(contract.UnderlyingType, _rootType))// handle Nullable<T> differently 506Type declaredType = contract.UnderlyingType; 644DataContract.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 == typeof(XmlQualifiedName)) 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 (typeof(IDeserializationCallback).IsAssignableFrom(classContract.UnderlyingType)) 105if (classContract.UnderlyingType == typeof(DateTimeOffsetAdapter)) 111else if (classContract.UnderlyingType == typeof(MemoryStreamAdapter)) 201_objectType = classContract.UnderlyingType; 206if (classContract.UnderlyingType == typeof(DBNull)) 263return typeof(IObjectReference).IsAssignableFrom(classContract.UnderlyingType); 458ConstructorInfo? ctor = classContract.UnderlyingType.GetConstructor(Globals.ScanAllMembers, JsonFormatGeneratorStatics.SerInfoCtorArgs); 460throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.SerializationInfo_ConstructorNotFound, DataContract.GetClrTypeFullName(classContract.UnderlyingType))); 463_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType); 483if ((primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) || nullables != 0 || type.IsValueType) 522if (primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) 605Type type = collectionContract.UnderlyingType; 767DataContract.GetClrTypeFullName(collectionContract.UnderlyingType), 826Type 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 == typeof(object)) 662if (primitiveContract != null && primitiveContract.UnderlyingType != typeof(object))
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 != typeof(object)) 239XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted(member.Name, classContract.UnderlyingType);
System\Runtime\Serialization\Json\XmlObjectSerializerWriteContextComplexJson.cs (9)
105(contract.UnderlyingType != typeof(object[])) && 125if (declaredContract.UnderlyingType == typeof(Enum)) 127throw new SerializationException(SR.Format(SR.EnumTypeNotSupportedByDataContractJsonSerializer, declaredContract.UnderlyingType)); 209if ((declaredType != dataContract.UnderlyingType) && (dataContract is CollectionDataContract)) 246Type declaredType = rootTypeDataContract!.UnderlyingType; 276throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.DcTypeNotFoundOnSerialize, DataContract.GetClrTypeFullName(dataContract.UnderlyingType), dataContract.XmlName.Name, dataContract.XmlName.Namespace)); 360oldItemContract.UnderlyingType.IsGenericType && 361(oldItemContract.UnderlyingType.GetGenericTypeDefinition() == typeof(KeyValue<,>))) 363return 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 != typeof(object) && !writeXsiType) 122if (primitiveContract == null || primitiveContract.UnderlyingType == typeof(object))
System\Runtime\Serialization\ReflectionReader.cs (13)
82XmlObjectSerializerReadContext.ThrowNullValueReturnedForGetOnlyCollectionException(collectionContract.UnderlyingType); 263if ((primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) || nullables != 0 || type.IsValueType) 294if (primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) 335SerializationInfo serializationInfo = context.ReadSerializationInfo(xmlReader, classContract.UnderlyingType); 355if ((primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) || 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 == typeof(IDictionary)) 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 != typeof(object)) 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 == typeof(object);
System\Runtime\Serialization\XmlDataContract.cs (11)
115return () => ReflectionCreateXmlSerializable(this.UnderlyingType); 121public override bool IsBuiltInDataContract => UnderlyingType == typeof(XmlElement) || UnderlyingType == typeof(XmlNode[]); 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, typeof(IXmlSerializable)); 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 (typeof(IDeserializationCallback).IsAssignableFrom(classContract.UnderlyingType)) 142if (classContract.UnderlyingType == typeof(DateTimeOffsetAdapter)) 148else if (classContract.UnderlyingType == typeof(MemoryStreamAdapter)) 256Type type = _objectType = classContract.UnderlyingType; 262if (classContract.UnderlyingType == typeof(DBNull)) 327return typeof(IObjectReference).IsAssignableFrom(classContract.UnderlyingType); 500_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType); 520if ((primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) || nullables != 0 || type.IsValueType) 559if (primitiveContract != null && primitiveContract.UnderlyingType != typeof(object)) 639Type type = collectionContract.UnderlyingType; 781Type 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 == typeof(object)) 675if (primitiveContract != null && primitiveContract.UnderlyingType != typeof(object) && !writeXsiType)
System\Runtime\Serialization\XmlObjectSerializerContext.cs (3)
231return knownContract != null && knownContract.UnderlyingType == dataContract.UnderlyingType; 267&& !memberTypeContract.UnderlyingType.IsInterface
System\Runtime\Serialization\XmlObjectSerializerReadContext.cs (7)
141if (TryHandleNullOrRef(reader, name, ns, dataContract.UnderlyingType, ref retObj)) 180throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.FactoryTypeNotISerializable, DataContract.GetClrTypeFullName(factoryDataContract.UnderlyingType), DataContract.GetClrTypeFullName(dataContract.UnderlyingType))); 518if (xmlDataContract.UnderlyingType == typeof(XmlElement)) 525else if (xmlDataContract.UnderlyingType == typeof(XmlNode[])) 673dataNode = ReadUnknownPrimitiveData(xmlReader, dataContract.UnderlyingType, dataContractName, dataContractNamespace); 678dataNode = new DataNode<object>(xmlReader.ReadElementContentAsAnyType(dataContract.UnderlyingType));
System\Runtime\Serialization\XmlObjectSerializerReadContextComplex.cs (2)
73if (this.IsGetOnlyCollection && dataContract.UnderlyingType != declaredType) 80object? obj = DataContractSurrogateCaller.GetDeserializedObject(_serializationSurrogateProvider, oldObj, dataContract.UnderlyingType, declaredType);
System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (3)
245if (knownContract == null || knownContract.UnderlyingType != dataContract.UnderlyingType) 247throw 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); 1086Type baseType = enumDataContract.BaseContract.UnderlyingType; 1654return dataContract != null && dataContract.Is(DataContractType.PrimitiveDataContract) && dataContract.UnderlyingType == typeof(object);
System\Runtime\Serialization\Schema\SchemaImportHelper.cs (1)
82return SchemaImportHelper.IsTypeNullable(itemContract.UnderlyingType);