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)
271if (root.GetIsNullableSpecified() && !root.IsNullable && model.TypeDesc.IsOptionalValue) 273throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, model.TypeDesc.BaseTypeDesc!.FullName, "XmlRoot")); 274element.IsNullable = root.GetIsNullableSpecified() ? root.IsNullable : model.TypeDesc.IsNullable || model.TypeDesc.IsOptionalValue; 275CheckNullable(element.IsNullable, model.TypeDesc, element.Mapping!); 278element.IsNullable = model.TypeDesc.IsNullable || model.TypeDesc.IsOptionalValue; 389TypeDesc modelTypeDesc = TypeScope.IsOptionalValue(model.Type) ? model.TypeDesc.BaseTypeDesc! : model.TypeDesc; 410switch (model.TypeDesc.Kind) 421if (context != ImportContext.Element) throw UnsupportedException(model.TypeDesc, context); 429if (context != ImportContext.Element) throw UnsupportedException(model.TypeDesc, context); 430if (model.TypeDesc.IsOptionalValue) 432TypeDesc valueTypeDesc = string.IsNullOrEmpty(dataType) ? model.TypeDesc.BaseTypeDesc! : TypeScope.GetTypeDesc(dataType, XmlSchema.Namespace)!; 436ImportTypeMapping(_modelScope.GetTypeModel(model.TypeDesc.BaseTypeDesc!.Type!), ns, context, dataType, null, repeats, openModel, limiter); 437return CreateNullableMapping(baseMapping, model.TypeDesc.Type!); 444if (model.TypeDesc.Kind == TypeKind.Serializable) 449throw new InvalidOperationException(SR.Format(SR.XmlSerializableAttributes, model.TypeDesc.FullName, nameof(XmlSchemaProviderAttribute))); 456if (model.TypeDesc.IsSpecial) 457return ImportSpecialMapping(model.Type, model.TypeDesc, ns, context); 458throw UnsupportedException(model.TypeDesc, context); 467throw CreateTypeReflectionException(model.TypeDesc.FullName, e); 713if (model.TypeDesc.Kind == TypeKind.Root) return GetRootMapping(); 722string? typeName = IsAnonymousType(a, ns) ? null : XsdTypeName(model.Type, a, model.TypeDesc.Name); 725StructMapping? mapping = (StructMapping?)GetTypeMapping(typeName, typeNs, model.TypeDesc, _types, model.Type); 729mapping.TypeDesc = model.TypeDesc; 781if (model.TypeDesc.BaseTypeDesc != null) 1077mapping.TypeDesc = model.TypeDesc; 1102if (existingMapping.TypeDesc == model.TypeDesc) 1159mapping.TypeDesc = model.TypeDesc; 1176string? typeName = IsAnonymousType(a, ns) ? null : XsdTypeName(model.Type, a, model.TypeDesc.Name); 1179EnumMapping? mapping = (EnumMapping?)GetTypeMapping(typeName, typeNs, model.TypeDesc, _types, model.Type); 1183mapping.TypeDesc = model.TypeDesc; 1188throw new InvalidOperationException(SR.Format(SR.XmlIllegalAttributeFlagsArray, model.TypeDesc.FullName)); 1203throw new InvalidOperationException(SR.Format(SR.XmlNoSerializableMembers, model.TypeDesc.FullName)); 1635if (xmlElement.GetIsNullableSpecified() && !xmlElement.IsNullable && typeModel.TypeDesc.IsOptionalValue) 1637throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc!.FullName, "XmlElement")); 1638element.IsNullable = xmlElement.GetIsNullableSpecified() ? xmlElement.IsNullable : typeModel.TypeDesc.IsOptionalValue; 1683typeModel.TypeDesc.IsMixed = true; 1808if (xmlElement.GetIsNullableSpecified() && !xmlElement.IsNullable && typeModel.TypeDesc.IsOptionalValue) 1810throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc!.FullName, "XmlElement")); 1811element.IsNullable = xmlElement.GetIsNullableSpecified() ? xmlElement.IsNullable : typeModel.TypeDesc.IsOptionalValue; 1876if (xmlElement.GetIsNullableSpecified() && !xmlElement.IsNullable && typeModel.TypeDesc.IsOptionalValue) 1878throw new InvalidOperationException(SR.Format(SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc!.FullName, "XmlElement")); 1879element.IsNullable = xmlElement.GetIsNullableSpecified() ? xmlElement.IsNullable : typeModel.TypeDesc.IsOptionalValue; 1926typeModel.TypeDesc.IsMixed = true;