71 references to TypeDesc
System.Private.Xml (71)
System\Xml\Serialization\SoapReflectionImporter.cs (25)
167if (!model.TypeDesc.IsPrimitive) 176if (model.TypeDesc.FullName != td.FullName) 178throw new InvalidOperationException(SR.Format(SR.XmlDataTypeMismatch, dataType, "SoapElementAttribute.DataType", model.TypeDesc.FullName)); 187switch (model.TypeDesc.Kind) 200if (model.TypeDesc.IsOptionalValue) 202TypeDesc? baseTypeDesc = model.TypeDesc.BaseTypeDesc; 207TypeDesc valueTypeDesc = string.IsNullOrEmpty(dataType) ? model.TypeDesc.BaseTypeDesc! : TypeScope.GetTypeDesc(dataType, XmlSchema.Namespace)!; 208string xsdTypeName = string.IsNullOrEmpty(dataType) ? model.TypeDesc.BaseTypeDesc!.Name : dataType; 212return CreateNullableMapping(baseMapping, model.TypeDesc.Type!); 219throw new NotSupportedException(SR.Format(SR.XmlUnsupportedSoapTypeKind, model.TypeDesc.FullName)); 298if (model.TypeDesc.Kind == TypeKind.Root) return GetRootMapping(); 305string typeName = XsdTypeName(model.Type, a, model.TypeDesc.Name); 308StructMapping? mapping = (StructMapping?)GetTypeMapping(typeName, typeNs, model.TypeDesc); 313mapping.TypeDesc = model.TypeDesc; 358if (model.TypeDesc.BaseTypeDesc != null) 400if (model.TypeDesc.IsValueType) 401throw new NotSupportedException(SR.Format(SR.XmlRpcRefsInValueType, model.TypeDesc.FullName)); 426throw new NotSupportedException(SR.Format(SR.XmlRpcArrayOfValueTypes, model.TypeDesc.FullName)); 428mapping.TypeDesc = model.TypeDesc; 442if (existingMapping.TypeDesc == model.TypeDesc) 547mapping.TypeDesc = model.TypeDesc; 561string typeName = XsdTypeName(model.Type, a, model.TypeDesc.Name); 564EnumMapping? mapping = (EnumMapping?)GetTypeMapping(typeName, typeNs, model.TypeDesc); 569mapping.TypeDesc = model.TypeDesc; 583throw new InvalidOperationException(SR.Format(SR.XmlNoSerializableMembers, model.TypeDesc.FullName));
System\Xml\Serialization\XmlReflectionImporter.cs (46)
284if (root.GetIsNullableSpecified() && !root.IsNullable && model.TypeDesc.IsOptionalValue) 286throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, model.TypeDesc.BaseTypeDesc!.FullName, "XmlRoot")); 287element.IsNullable = root.GetIsNullableSpecified() ? root.IsNullable : model.TypeDesc.IsNullable || model.TypeDesc.IsOptionalValue; 288CheckNullable(element.IsNullable, model.TypeDesc, element.Mapping!); 291element.IsNullable = model.TypeDesc.IsNullable || model.TypeDesc.IsOptionalValue; 404TypeDesc modelTypeDesc = TypeScope.IsOptionalValue(model.Type) ? model.TypeDesc.BaseTypeDesc! : model.TypeDesc; 425switch (model.TypeDesc.Kind) 436if (context != ImportContext.Element) throw UnsupportedException(model.TypeDesc, context); 444if (context != ImportContext.Element) throw UnsupportedException(model.TypeDesc, context); 445if (model.TypeDesc.IsOptionalValue) 447TypeDesc valueTypeDesc = string.IsNullOrEmpty(dataType) ? model.TypeDesc.BaseTypeDesc! : TypeScope.GetTypeDesc(dataType, XmlSchema.Namespace)!; 451ImportTypeMapping(_modelScope.GetTypeModel(model.TypeDesc.BaseTypeDesc!.Type!), ns, context, dataType, null, repeats, openModel, limiter); 452return CreateNullableMapping(baseMapping, model.TypeDesc.Type!); 459if (model.TypeDesc.Kind == TypeKind.Serializable) 464throw new InvalidOperationException(SR.Format(SR.XmlSerializableAttributes, model.TypeDesc.FullName, nameof(XmlSchemaProviderAttribute))); 471if (model.TypeDesc.IsSpecial) 472return ImportSpecialMapping(model.Type, model.TypeDesc, ns, context); 473throw UnsupportedException(model.TypeDesc, context); 482throw CreateTypeReflectionException(model.TypeDesc.FullName, e); 730if (model.TypeDesc.Kind == TypeKind.Root) return GetRootMapping(); 739string? typeName = IsAnonymousType(a, ns) ? null : XsdTypeName(model.Type, a, model.TypeDesc.Name); 742StructMapping? mapping = (StructMapping?)GetTypeMapping(typeName, typeNs, model.TypeDesc, _types, model.Type); 746mapping.TypeDesc = model.TypeDesc; 799if (model.TypeDesc.BaseTypeDesc != null) 1096mapping.TypeDesc = model.TypeDesc; 1121if (existingMapping.TypeDesc == model.TypeDesc) 1178mapping.TypeDesc = model.TypeDesc; 1195string? typeName = IsAnonymousType(a, ns) ? null : XsdTypeName(model.Type, a, model.TypeDesc.Name); 1198EnumMapping? mapping = (EnumMapping?)GetTypeMapping(typeName, typeNs, model.TypeDesc, _types, model.Type); 1202mapping.TypeDesc = model.TypeDesc; 1207throw new InvalidOperationException(SR.Format(SR.XmlIllegalAttributeFlagsArray, model.TypeDesc.FullName)); 1222throw new InvalidOperationException(SR.Format(SR.XmlNoSerializableMembers, model.TypeDesc.FullName)); 1659if (xmlElement.GetIsNullableSpecified() && !xmlElement.IsNullable && typeModel.TypeDesc.IsOptionalValue) 1661throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc!.FullName, "XmlElement")); 1662element.IsNullable = xmlElement.GetIsNullableSpecified() ? xmlElement.IsNullable : typeModel.TypeDesc.IsOptionalValue; 1707typeModel.TypeDesc.IsMixed = true; 1832if (xmlElement.GetIsNullableSpecified() && !xmlElement.IsNullable && typeModel.TypeDesc.IsOptionalValue) 1834throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc!.FullName, "XmlElement")); 1835element.IsNullable = xmlElement.GetIsNullableSpecified() ? xmlElement.IsNullable : typeModel.TypeDesc.IsOptionalValue; 1900if (xmlElement.GetIsNullableSpecified() && !xmlElement.IsNullable && typeModel.TypeDesc.IsOptionalValue) 1902throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc!.FullName, "XmlElement")); 1903element.IsNullable = xmlElement.GetIsNullableSpecified() ? xmlElement.IsNullable : typeModel.TypeDesc.IsOptionalValue; 1950typeModel.TypeDesc.IsMixed = true;