41 writes to TypeDesc
System.Private.Xml (41)
System\Xml\Serialization\SchemaImporter.cs (1)
114
mapping.
TypeDesc
= typeDesc;
System\Xml\Serialization\SoapReflectionImporter.cs (9)
229
mapping.
TypeDesc
= typeDesc;
286
mapping.
TypeDesc
= typeDesc;
313
mapping.
TypeDesc
= model.TypeDesc;
428
mapping.
TypeDesc
= model.TypeDesc;
534
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, XmlSchema.Namespace);
538
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, UrtTypes.Namespace);
547
mapping.
TypeDesc
= model.TypeDesc;
569
mapping.
TypeDesc
= model.TypeDesc;
609
members.
TypeDesc
= _typeScope.GetTypeDesc(typeof(object[]));
System\Xml\Serialization\XmlReflectionImporter.cs (12)
561
serializableMapping.
TypeDesc
= typeDesc;
569
serializableMapping.
TypeDesc
= typeDesc;
577
mapping.
TypeDesc
= typeDesc;
638
mapping.
TypeDesc
= typeDesc;
684
mapping.
TypeDesc
= typeDesc;
746
mapping.
TypeDesc
= model.TypeDesc;
1100
mapping.
TypeDesc
= model.TypeDesc;
1170
mapping.
TypeDesc
= TypeScope.GetMatchingTypeDesc(dataType, XmlSchema.Namespace, modelTypeDesc.FullName);
1174
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, UrtTypes.Namespace);
1183
mapping.
TypeDesc
= model.TypeDesc;
1207
mapping.
TypeDesc
= model.TypeDesc;
1255
members.
TypeDesc
= _typeScope.GetTypeDesc(typeof(object[]));
System\Xml\Serialization\XmlSchemaImporter.cs (19)
44
mapping.
TypeDesc
= TypeScope.GetTypeDesc("string", XmlSchema.Namespace, flags);
215
mapping.
TypeDesc
= Scope.GetTypeDesc(typeof(object[]));
488
mappings.
TypeDesc
= Scope.GetTypeDesc(typeof(object[]));
558
structMapping.
TypeDesc
= new TypeDesc(typeName, typeName, TypeKind.Struct, baseTypeDesc, flags);
614
structMapping.
TypeDesc
= new TypeDesc(typeName, typeName, TypeKind.Struct, baseTypeDesc, flags);
1183
textMapping.
TypeDesc
= Scope.GetTypeDesc(typeof(XmlNode));
1205
mapping.
TypeDesc
= Scope.GetTypeDesc(makeElement ? typeof(XmlElement) : typeof(XmlNode));
1294
arrayMapping.
TypeDesc
= choiceMember.TypeDesc;
1312
arrayMapping.
TypeDesc
= ((TypeMapping)itemAccessor.Mapping!).TypeDesc!.CreateArrayTypeDesc();
1384
mapping.
TypeDesc
= Scope.GetTypeDesc(typeof(XmlElement));
1393
mapping.
TypeDesc
= Scope.GetTypeDesc(mixed ? typeof(XmlNode) : typeof(XmlElement));
1398
mapping.
TypeDesc
= mapping.TypeDesc.CreateArrayTypeDesc();
1491
mapping.
TypeDesc
= Scope.GetTypeDesc(typeof(XmlAttribute));
1552
xmlnsMapping.
TypeDesc
= xmlnsTypeDesc;
1591
mapping.
TypeDesc
= Scope.GetTypeDesc(typeof(string));
1744
enumMapping.
TypeDesc
= new TypeDesc(typeName, typeName, TypeKind.Enum, null, 0);
1801
enumMapping.
TypeDesc
= new TypeDesc(typeName, typeName, TypeKind.Enum, null, 0);
1831
mapping.
TypeDesc
= sourceTypeDesc;
1847
mapping.
TypeDesc
= typeDesc;
690 references to TypeDesc
System.Private.Xml (690)
System\Xml\Serialization\Compilation.cs (1)
455
VerifyLoadContext(mapping.Accessor.Mapping?.
TypeDesc
?.Type, mainAssembly);
System\Xml\Serialization\Mappings.cs (15)
616
if (BaseMapping == null || BaseMapping.
TypeDesc
!.IsRoot)
625
throw new InvalidOperationException(SR.Format(SR.XmlIllegalSimpleContentExtension,
TypeDesc
!.FullName, BaseMapping.
TypeDesc
.FullName));
636
if (!_hasSimpleContent && text != null && !text.Mapping!.
TypeDesc
!.CanBeTextValue && !(BaseMapping != null && !BaseMapping.
TypeDesc
!.IsRoot && (text.Mapping.
TypeDesc
.IsEnum || text.Mapping.
TypeDesc
.IsPrimitive)))
638
throw new InvalidOperationException(SR.Format(SR.XmlIllegalTypedTextAttribute,
TypeDesc
!.FullName, text.Name, text.Mapping.
TypeDesc
.FullName));
659
if (
TypeDesc
!.IsRoot)
665
while (start.BaseMapping != null && !start.BaseMapping.IsSequence && !start.BaseMapping.
TypeDesc
!.IsRoot)
677
get { return _isSequence && !
TypeDesc
!.IsRoot; }
755
int w1 = a1.Mapping!.
TypeDesc
!.Weight;
756
int w2 = a2.Mapping!.
TypeDesc
!.Weight;
1107
throw new InvalidOperationException(SR.Format(SR.XmlCircularDerivation,
TypeDesc
!.FullName));
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (63)
40
!mapping.
TypeDesc
!.IsRoot)
45
mapping.
TypeDesc
.Type!,
455
memberMapping.TypeDesc = mapping.
TypeDesc
;
686
if (special.
TypeDesc
!.Kind == TypeKind.Node)
699
if (text.Mapping!.
TypeDesc
!.CollapseWhitespace)
710
if (text.Mapping!.
TypeDesc
== StringTypeDesc || text.Mapping.
TypeDesc
!.FormatterName == "String")
712
value = ReadString(null, text.Mapping.
TypeDesc
.CollapseWhitespace);
769
TypeDesc td = nullableMapping.BaseMapping!.
TypeDesc
!;
774
elementType = ele.Mapping!.
TypeDesc
!.Type!;
859
if (element.Mapping.
TypeDesc
!.IsValueType)
861
value = ReflectionCreateObject(element.Mapping.
TypeDesc
.Type!);
868
else if ((element.Default != null && element.Default != DBNull.Value && element.Mapping.
TypeDesc
!.IsValueType)
873
else if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan) && Reader.IsEmptyElement)
878
else if (element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset) && Reader.IsEmptyElement)
883
else if (element.Mapping.
TypeDesc
!.Type == typeof(DateOnly) && Reader.IsEmptyElement)
888
else if (element.Mapping.
TypeDesc
!.Type == typeof(TimeOnly) && Reader.IsEmptyElement)
895
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
901
if (element.Mapping.
TypeDesc
.FormatterName == "ByteArrayBase64")
905
else if (element.Mapping.
TypeDesc
.FormatterName == "ByteArrayHex")
926
if (!mapping.
TypeDesc
!.IsValueType || rre != null)
953
isNullable: mapping.
TypeDesc
!.IsNullable && element.IsNullable,
962
switch (specialMapping.
TypeDesc
!.Kind)
965
bool isDoc = specialMapping.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
995
value = ReadSerializable((IXmlSerializable)ReflectionCreateObject(sm.
TypeDesc
!.Type!)!, isWrappedAny);
1035
object? WriteStruct() => WriteStructMethod(structMapping, mapping.
TypeDesc
!.IsNullable, true, defaultNamespace: null);
1085
return mapping.
TypeDesc
!.CanBeElementValue;
1103
TypeDesc td = arrayMapping.
TypeDesc
!;
1135
TypeDesc = arrayMapping.
TypeDesc
,
1182
else if (mapping.
TypeDesc
== StringTypeDesc)
1186
else if (mapping.
TypeDesc
!.FormatterName == "String")
1188
if (mapping.
TypeDesc
.CollapseWhitespace)
1199
if (!mapping.
TypeDesc
.HasCustomFormatter)
1202
object retObj = mapping.
TypeDesc
.FormatterName switch
1220
_ => throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorDetails, $"unknown FormatterName: {mapping.
TypeDesc
.FormatterName}")),
1226
string methodName = $"To{mapping.
TypeDesc
.FormatterName}";
1230
throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorDetails, $"unknown FormatterName: {mapping.
TypeDesc
.FormatterName}"));
1248
object? o = Activator.CreateInstance(nullableMapping.
TypeDesc
!.Type!);
1254
element.IsNullable = nullableMapping.BaseMapping!.
TypeDesc
!.IsNullable;
1280
return Enum.ToObject(mapping.
TypeDesc
!.Type!, ToEnum(source, table, mapping.
TypeDesc
.Name));
1288
return Enum.Parse(mapping.
TypeDesc
!.Type!, c.Name);
1292
throw CreateUnknownConstantException(source, mapping.
TypeDesc
!.Type!);
1340
if (structMapping.
TypeDesc
!.IsRoot)
1345
if (structMapping.
TypeDesc
.IsAbstract)
1351
object? o = ReflectionCreateObject(structMapping.
TypeDesc
.Type!);
1523
if (structMapping.
TypeDesc
!.IsRoot && isNull)
1531
if (structMapping.
TypeDesc
.IsValueType)
1533
return ReflectionCreateObject(structMapping.
TypeDesc
.Type!);
1543
if (xsiType == null || (!structMapping.
TypeDesc
.IsRoot && QNameEqual(xsiType, structMapping.TypeName, defaultNamespace)))
1545
if (structMapping.
TypeDesc
.IsRoot)
1554
else if (structMapping.
TypeDesc
.IsRoot && WriteEnumAndArrayTypes(out o, xsiType, defaultNamespace))
1560
if (structMapping.
TypeDesc
.IsRoot)
1567
if (structMapping.
TypeDesc
!.IsNullable && isNull)
1571
else if (structMapping.
TypeDesc
.IsAbstract)
1577
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
1584
object? o = ReflectionCreateObject(structMapping.
TypeDesc
.Type!)!;
1639
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
1760
object choiceValue = Enum.Parse(choice.Mapping!.
TypeDesc
!.Type!, name);
1979
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
1983
else if (special.
TypeDesc
.CanBeAttributeValue)
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (38)
47
!mapping.
TypeDesc
!.IsRoot)
50
mapping.
TypeDesc
.Type!,
53
CreateXmlSerializationWriteCallback(mapping, mapping.TypeName!, mapping.Namespace, mapping.
TypeDesc
.IsNullable)
105
if (!mapping.
TypeDesc
!.IsValueType && !mapping.
TypeDesc
.Type!.IsPrimitive)
110
WriteMember(o, null, new ElementAccessor[] { element }, null, null, mapping.
TypeDesc
, !element.IsSoap);
146
throw CreateInvalidChoiceIdentifierValueException(choice.Mapping!.
TypeDesc
!.FullName, choice.MemberName!);
226
TypeDesc td = element.Mapping!.
TypeDesc
!;
227
bool enumUseReflection = choice.Mapping!.
TypeDesc
!.UseReflection;
228
string enumTypeName = choice.Mapping!.
TypeDesc
!.FullName;
250
TypeDesc td = element.IsUnbounded ? element.Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : element.Mapping!.
TypeDesc
!;
274
throw CreateChoiceIdentifierValueException(choice.Mapping!.
TypeDesc
!.FullName, choice.MemberName!, elem.Name, elem.NamespaceURI);
342
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, choiceMapping.
TypeDesc
!.FullName));
345
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, choiceMapping.
TypeDesc
!.FullName, element.Namespace + ":" + element.Name, element.Name, element.Namespace));
363
if (!WritePrimitiveValue(primitiveMapping.
TypeDesc
!, o, out stringValue))
380
switch (specialMapping.
TypeDesc
!.Kind)
425
WritePotentiallyReferencingElement(name, ns, o, mapping.
TypeDesc
!.Type, true, element.IsNullable);
468
if (mapping!.
TypeDesc
== ReflectionXmlSerializationReader.QnameTypeDesc)
486
WritePrimitiveMethodRequirement suffixRaw = mapping.
TypeDesc
!.XmlEncodingNotRequired ? WritePrimitiveMethodRequirement.Raw : WritePrimitiveMethodRequirement.None;
498
WritePotentiallyReferencingElement(name, ns, o, !writeAccessor ? mapping.
TypeDesc
!.Type : null, !writeAccessor, element.IsNullable);
554
bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.
TypeDesc
!.HasDefaultSupport;
584
if (mapping.IsSoap && mapping.
TypeDesc
!.IsRoot) return;
595
&& o.GetType() != mapping.
TypeDesc
!.Type)
602
if (mapping.
TypeDesc
.IsRoot)
617
if (!mapping.
TypeDesc
!.IsAbstract)
619
if (mapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.
TypeDesc
.Type))
637
if (!mapping.
TypeDesc
.IsRoot)
741
if (m is EnumMapping em && em.
TypeDesc
!.Type == objType)
750
if (m is ArrayMapping am && am.
TypeDesc
!.Type == objType)
754
WriteMember(o, null, am.ElementsSortedByDerivation!, null, null, am.
TypeDesc
!, true);
801
throw CreateInvalidEnumValueException(v, mapping.
TypeDesc
!.FullName);
952
if (special.
TypeDesc
!.Kind == TypeKind.Attribute || special.
TypeDesc
.CanBeAttributeValue)
986
if (t == derived.
TypeDesc
!.Type)
1003
TypeDesc typeDesc = mapping.
TypeDesc
!;
1004
bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.
TypeDesc
!.HasDefaultSupport;
System\Xml\Serialization\SchemaImporter.cs (2)
88
TypeDesc typeDescToChange = structMapping.
TypeDesc
!;
97
throw new InvalidOperationException(SR.Format(SR.XmlInvalidBaseType, structMapping.
TypeDesc
!.FullName, baseType.FullName, typeDescToChange.BaseTypeDesc.FullName));
System\Xml\Serialization\SoapReflectionImporter.cs (17)
252
if (mapping.
TypeDesc
!= typeDesc)
253
throw new InvalidOperationException(SR.Format(SR.XmlTypesDuplicate, typeDesc.FullName, mapping.
TypeDesc
!.FullName, typeName, ns));
260
TypeDesc typeDesc = baseMapping.
TypeDesc
!.GetNullableTypeDesc(type);
276
throw new InvalidOperationException(SR.Format(SR.XmlTypesDuplicate, typeDesc.FullName, existingMapping.
TypeDesc
!.FullName, typeDesc.Name, existingMapping.Namespace));
281
throw new InvalidOperationException(SR.Format(SR.XmlTypesDuplicate, typeDesc.FullName, existingMapping.
TypeDesc
!.FullName, typeDesc.Name, existingMapping.Namespace));
425
if (itemTypeMapping.
TypeDesc
!.IsValueType && !itemTypeMapping.
TypeDesc
.IsPrimitive && !itemTypeMapping.
TypeDesc
.IsEnum)
442
if (existingMapping.
TypeDesc
== model.TypeDesc)
477
itemTypeNamespace = itemTypeMapping.
TypeDesc
!.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
478
itemTypeName = itemTypeMapping.
TypeDesc
.DataType!.Name!;
483
if (itemTypeMapping.
TypeDesc
!.IsRoot)
502
throw new InvalidOperationException(SR.Format(SR.XmlInvalidSoapArray, mapping.
TypeDesc
!.FullName));
535
if (mapping.
TypeDesc
== null)
539
if (mapping.
TypeDesc
== null)
549
mapping.TypeName = mapping.
TypeDesc
.DataType!.Name;
550
mapping.Namespace = mapping.
TypeDesc
.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
System\Xml\Serialization\Types.cs (2)
798
if (typeMapping.
TypeDesc
== typeDesc)
1215
if (ShouldBeReplaced(pair.Value, structMapping.
TypeDesc
!.Type!, out replacedInfo))
System\Xml\Serialization\XmlReflectionImporter.cs (28)
127
if (mapping.IsAnonymousType && !mapping.
TypeDesc
!.IsSpecial)
301
return ((TypeMapping)mapping).
TypeDesc
!.FullName;
330
if (accessor.Mapping!.
TypeDesc
== existing.Mapping!.
TypeDesc
331
|| (existing.Mapping is NullableMapping && accessor.Mapping.
TypeDesc
== ((NullableMapping)existing.Mapping).BaseMapping!.
TypeDesc
)
332
|| (accessor.Mapping is NullableMapping && ((NullableMapping)accessor.Mapping).BaseMapping!.
TypeDesc
== existing.Mapping.
TypeDesc
))
516
CheckContext(mapping.
TypeDesc
!, context);
649
TypeDesc typeDesc = baseMapping.
TypeDesc
!.GetNullableTypeDesc(type);
674
throw new InvalidOperationException(SR.Format(SR.XmlTypesDuplicate, typeDesc.FullName, existingMapping.
TypeDesc
!.FullName, typeDesc.Name, existingMapping.Namespace));
679
throw new InvalidOperationException(SR.Format(SR.XmlTypesDuplicate, typeDesc.FullName, existingMapping.
TypeDesc
!.FullName, typeDesc.Name, existingMapping.Namespace));
721
if (!mapping.IsAnonymousType && mapping.
TypeDesc
!= typeDesc)
722
throw new InvalidOperationException(SR.Format(SR.XmlTypesDuplicate, typeDesc.FullName, mapping.
TypeDesc
!.FullName, typeName, ns));
877
if (!member.Text.Mapping!.
TypeDesc
!.CanBeTextValue && member.Text.Mapping.IsList)
878
throw new InvalidOperationException(SR.Format(SR.XmlIllegalTypedTextAttribute, typeName, member.Text.Name, member.Text.Mapping.
TypeDesc
.FullName));
1049
name = itemTypeMapping.
TypeDesc
!.DataType!.Name;
1051
else if (itemTypeMapping is StructMapping && itemTypeMapping.
TypeDesc
!.IsRoot)
1125
if (existingMapping.
TypeDesc
== model.TypeDesc)
1171
if (mapping.
TypeDesc
== null)
1175
if (mapping.
TypeDesc
== null)
1185
mapping.TypeName = mapping.
TypeDesc
.DataType!.Name;
1186
mapping.Namespace = mapping.
TypeDesc
.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
1188
CheckContext(mapping.
TypeDesc
, context);
1832
if (element.Mapping.
TypeDesc
!.Kind == TypeKind.Node)
2032
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, accessor.ChoiceIdentifier.Mapping!.
TypeDesc
!.FullName));
2038
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, accessor.ChoiceIdentifier.Mapping!.
TypeDesc
!.FullName, id, element.Name, element.Namespace));
2274
bool isAny = mapping.
TypeDesc
!.Kind == TypeKind.Node;
System\Xml\Serialization\XmlSchemaExporter.cs (29)
231
if (!accessor.Mapping!.IncludeInSchema && !accessor.Mapping.
TypeDesc
!.IsRoot)
400
XmlSchemaSimpleType type = (XmlSchemaSimpleType)mapping.
TypeDesc
!.DataType!;
409
return new XmlQualifiedName(mapping.
TypeDesc
.DataType!.Name, UrtTypes.Namespace);
414
switch (mapping.
TypeDesc
!.Kind)
419
type.IsMixed = mapping.
TypeDesc
.IsMixed;
439
type.IsMixed = mapping.
TypeDesc
.IsMixed;
572
if (mapping.
TypeDesc
!.IsXsdType)
574
qname = new XmlQualifiedName(mapping.
TypeDesc
.DataType!.Name, XmlSchema.Namespace);
724
if (!accessor.HasDefault && !valueTypeOptional && accessor.Mapping!.
TypeDesc
!.IsValueType)
811
int minOccurs = repeats || accessor.HasDefault || (!accessor.IsNullable && !accessor.Mapping!.
TypeDesc
!.IsValueType) || valueTypeOptional ? 0 : 1;
889
return val != 0 ? XmlCustomFormatter.FromEnum(val, names, ids, mapping.
TypeDesc
!.FullName) : null;
906
if (!pm.
TypeDesc
!.HasCustomFormatter)
910
if (pm.
TypeDesc
.Type == null)
912
throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorDetails, "Mapping for " + pm.
TypeDesc
.Name + " missing type property"));
916
if (pm.
TypeDesc
.FormatterName == "String")
920
System.Reflection.MethodInfo? format = formatter.GetMethod("ToString", new Type[] { pm.
TypeDesc
.Type! });
926
string defaultValue = XmlCustomFormatter.FromDefaultValue(value, pm.
TypeDesc
.FormatterName!);
928
throw new InvalidOperationException(SR.Format(SR.XmlInvalidDefaultValue, value, pm.
TypeDesc
.Name));
931
throw new InvalidOperationException(SR.Format(SR.XmlInvalidDefaultValue, value, pm.
TypeDesc
.Name));
940
if (mapping is StructMapping && mapping.
TypeDesc
!.IsRoot)
957
if (mapping.
TypeDesc
!.IsRoot)
965
throw new InvalidOperationException(SR.Format(SR.XmlCircularReference2, mapping.
TypeDesc
.Name, "AnonymousType", "false"));
971
if (!mapping.IncludeInSchema) throw new InvalidOperationException(SR.Format(SR.XmlCannotIncludeInSchema, mapping.
TypeDesc
.Name));
980
type.IsAbstract = mapping.
TypeDesc
.IsAbstract;
986
throw new InvalidOperationException(SR.Format(SR.XmlAnonymousBaseType, mapping.
TypeDesc
.Name, mapping.BaseMapping.
TypeDesc
!.Name, "AnonymousType", "false"));
1091
throw new InvalidOperationException(SR.Format(SR.XmlAnonymousBaseType, textMapping.
TypeDesc
!.Name, pm.
TypeDesc
!.Name, "AnonymousType", "false"));
1138
if (!mapping.IncludeInSchema) throw new InvalidOperationException(SR.Format(SR.XmlCannotIncludeInSchema, mapping.
TypeDesc
!.Name));
System\Xml\Serialization\XmlSchemaImporter.cs (40)
45
mapping.TypeName = mapping.
TypeDesc
!.DataType!.Name;
106
accessor.IsNullable = typeMapping.
TypeDesc
!.IsNullable;
209
member.TypeDesc = accessor.Mapping!.
TypeDesc
;
506
baseTypeDesc = ((StructMapping)baseMapping).
TypeDesc
;
514
baseTypeDesc = baseMapping.
TypeDesc
;
591
throw new InvalidOperationException(SR.Format(SR.XmlIllegalOverride, type.Name, baseMember.Name, baseMember.TypeDesc!.FullName, structMapping.Members[i].TypeDesc!.FullName, declaringMapping!.
TypeDesc
!.FullName));
787
string tdFullName = element.Mapping!.
TypeDesc
!.FullName;
824
typeDescs[i] = ((ElementAccessor)enumerator.Current).Mapping!.
TypeDesc
!;
857
choiceIdentifier.TypeDesc = member.ChoiceIdentifier.Mapping.
TypeDesc
!.CreateArrayTypeDesc();
861
choiceIdentifier.TypeDesc = member.ChoiceIdentifier.Mapping.
TypeDesc
;
895
if (item.Mapping!.
TypeDesc
!= null)
897
if (item.IsNullable != item.Mapping.
TypeDesc
.IsNullable)
900
if (item.Mapping.
TypeDesc
.IsAmbiguousDataType)
995
if (scopeElement.Mapping!.
TypeDesc
!= element.Mapping!.
TypeDesc
)
1123
if (!(mapping is PrimitiveMapping || mapping!.
TypeDesc
!.CanBeTextValue))
1144
member.TypeDesc = accessor.Mapping.
TypeDesc
!.CreateArrayTypeDesc();
1153
member.TypeDesc = accessor.Mapping.
TypeDesc
!.CreateArrayTypeDesc();
1158
member.TypeDesc = accessor.Mapping.
TypeDesc
;
1176
member.TypeDesc = ((TypeMapping)accessors[0].Mapping!).
TypeDesc
;
1184
textMapping.TypeName = textMapping.
TypeDesc
.Name;
1185
member.TypeDesc = textMapping.
TypeDesc
;
1206
mapping.TypeName = mapping.
TypeDesc
.Name;
1252
if (arrayMapping.
TypeDesc
!.IsNullable)
1296
arrayMapping.TypeName = string.IsNullOrEmpty(type.Name) ? $"ArrayOf{CodeIdentifier.MakePascal(arrayMapping.
TypeDesc
!.Name)}" : type.Name;
1312
arrayMapping.TypeDesc = ((TypeMapping)itemAccessor.Mapping!).
TypeDesc
!.CreateArrayTypeDesc();
1313
arrayMapping.TypeName = string.IsNullOrEmpty(type.Name) ? $"ArrayOf{CodeIdentifier.MakePascal(itemAccessor.Mapping.
TypeDesc
.Name)}" : type.Name;
1396
mapping.TypeName = mapping.
TypeDesc
.Name;
1398
mapping.TypeDesc = mapping.
TypeDesc
.CreateArrayTypeDesc();
1434
member.TypeDesc = accessor.Mapping.
TypeDesc
;
1438
member.TypeDesc = accessor.Mapping.
TypeDesc
;
1452
member.TypeDesc = accessor.Mapping.
TypeDesc
!.CreateArrayTypeDesc();
1479
member.TypeDesc = accessor.IsList ? accessor.Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : accessor.Mapping!.
TypeDesc
;
1492
mapping.TypeName = mapping.
TypeDesc
.Name;
1504
member.TypeDesc = ((TypeMapping)accessor.Mapping).
TypeDesc
;
1553
xmlnsMapping.TypeName = xmlnsMapping.
TypeDesc
.Name;
1592
mapping.TypeName = mapping.
TypeDesc
.DataType!.Name;
1833
mapping.Namespace = mapping.
TypeDesc
.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
1849
mapping.Namespace = mapping.
TypeDesc
.IsXsdType ? XmlSchema.Namespace : ns;
System\Xml\Serialization\XmlSerializationGeneratedCode.cs (3)
241
string serializerName = CodeIdentifier.MakeValid(Accessor.UnescapeName(mapping.Accessor.Mapping!.
TypeDesc
!.Name));
346
Type? type = xmlMappings[i].Accessor.Mapping!.
TypeDesc
!.Type;
401
return mapping.
TypeDesc
!.CanBeElementValue;
System\Xml\Serialization\XmlSerializationILGen.cs (3)
314
string serializerName = CodeIdentifier.MakeValid(Accessor.UnescapeName(mapping.Accessor.Mapping!.
TypeDesc
!.Name));
448
Type? type = xmlMappings[i].Accessor.Mapping!.
TypeDesc
!.Type;
569
return mapping.
TypeDesc
!.CanBeElementValue;
System\Xml\Serialization\XmlSerializationReader.cs (127)
2157
bool choiceUseReflection = mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection;
2158
string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.
TypeDesc
.CSharpName;
2162
_choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, $"{c}++", mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
2271
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
2417
!mapping.
TypeDesc
!.IsRoot)
2433
Writer.Write(RaCodeGen.GetStringForTypeof(mapping.
TypeDesc
.CSharpName, mapping.
TypeDesc
.UseReflection));
2823
member.TypeDesc = mapping.
TypeDesc
;
2852
if (enumMethodName == null) throw new InvalidOperationException(SR.Format(SR.XmlMissingMethodEnum, mapping.
TypeDesc
!.Name));
2857
Writer.Write(mapping.
TypeDesc
!.CSharpName);
2865
else if (mapping.
TypeDesc
== StringTypeDesc)
2869
else if (mapping.
TypeDesc
!.FormatterName == "String")
2871
if (mapping.
TypeDesc
.CollapseWhitespace)
2884
if (!mapping.
TypeDesc
.HasCustomFormatter)
2890
Writer.Write(mapping.
TypeDesc
.FormatterName);
2961
if (!mapping.
TypeDesc
!.UseReflection)
2964
Writer.Write(mapping.
TypeDesc
.CSharpName);
3001
tableName = WriteHashtable(mapping, mapping.
TypeDesc
!.Name);
3005
bool useReflection = mapping.
TypeDesc
!.UseReflection;
3006
string fullTypeName = mapping.
TypeDesc
.CSharpName;
3096
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
!.Name));
3100
if (derived.
TypeDesc
!.UseReflection && isTypedReturn)
3104
if (derived.
TypeDesc
.IsNullable)
3133
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, enumMapping.
TypeDesc
!.Name));
3145
if (arrayMapping.
TypeDesc
!.HasDefaultConstructor)
3152
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
3156
TypeDesc td = arrayMapping.
TypeDesc
;
3157
string fullTypeName = arrayMapping.
TypeDesc
.CSharpName;
3168
if (arrayMapping.
TypeDesc
.IsValueType)
3189
bool useReflection = nullableMapping.BaseMapping!.
TypeDesc
!.UseReflection;
3190
string typeName = useReflection ? "object" : nullableMapping.
TypeDesc
!.CSharpName;
3223
element.IsNullable = nullableMapping.BaseMapping.
TypeDesc
.IsNullable;
3243
bool useReflection = structMapping.
TypeDesc
!.UseReflection;
3244
string typeName = useReflection ? "object" : structMapping.
TypeDesc
.CSharpName;
3250
if (structMapping.
TypeDesc
.IsNullable)
3258
if (structMapping.
TypeDesc
.IsNullable)
3262
if (structMapping.
TypeDesc
.IsRoot)
3269
if (structMapping.
TypeDesc
.IsValueType)
3271
Writer.Write(RaCodeGen.GetStringForCreateInstance(structMapping.
TypeDesc
.CSharpName, useReflection, false, false));
3281
if (!structMapping.
TypeDesc
.IsRoot)
3287
if (structMapping.
TypeDesc
.IsRoot)
3296
WriteDerivedTypes(structMapping, !useReflection && !structMapping.
TypeDesc
.IsRoot, typeName);
3297
if (structMapping.
TypeDesc
.IsRoot) WriteEnumAndArrayTypes();
3298
if (structMapping.
TypeDesc
.IsRoot)
3306
if (structMapping.
TypeDesc
.IsRoot)
3309
if (structMapping.
TypeDesc
.IsNullable)
3312
if (structMapping.
TypeDesc
.IsAbstract)
3322
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
3343
string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.
TypeDesc
);
3344
Member member = new Member(this, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3349
member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", $"{mapping.Name}Specified", structMapping.
TypeDesc
);
3370
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
3374
Member arrayMember = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3447
if (structMapping.
TypeDesc
!.IsRoot)
3462
if (structMapping.
TypeDesc
.IsAbstract)
3483
string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.
TypeDesc
);
3484
Member member = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3486
member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", $"{mapping.Name}Specified", structMapping.
TypeDesc
);
3518
if (anyFixups) WriteFixupMethod(fixupMethodName, members, structMapping.
TypeDesc
.CSharpName, structMapping.
TypeDesc
.UseReflection, true, "o");
3825
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
3832
else if (special.
TypeDesc
.CanBeAttributeValue)
3947
WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName}[]",
3949
member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
4104
WriteSourceBeginTyped(member.ArraySource, special.
TypeDesc
);
4105
switch (special.
TypeDesc
!.Kind)
4120
if (text.Mapping!.
TypeDesc
!.CollapseWhitespace)
4131
if (text.Mapping!.
TypeDesc
== StringTypeDesc || text.Mapping.
TypeDesc
!.FormatterName == "String")
4134
if (text.Mapping.
TypeDesc
!.CollapseWhitespace)
4274
TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.
TypeDesc
!;
4279
Writer.Write(RaCodeGen.GetStringForTypeof(e.Mapping!.
TypeDesc
!.CSharpName, e.Mapping.
TypeDesc
.UseReflection));
4304
if (e.Mapping!.
TypeDesc
!.IsValueType || e.Mapping is NullableMapping)
4314
TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.
TypeDesc
!;
4315
Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.
TypeDesc
.CSharpName, e.Mapping.
TypeDesc
.UseReflection, false, true, $"({td.CSharpName}){checkTypeSource}"));
4319
WriteSourceBeginTyped(member.ArraySource, e.Mapping.
TypeDesc
);
4324
if (e.Mapping.
TypeDesc
.IsValueType)
4486
bool choiceUseReflection = member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection;
4487
string choiceTypeName = member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.CSharpName;
4561
TypeDesc td = arrayMapping.
TypeDesc
!;
4574
WriteSourceBeginTyped(source, arrayMapping.
TypeDesc
);
4578
WriteCatchCastException(arrayMapping.
TypeDesc
!, "rre", null);
4588
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
4661
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.
TypeDesc
!.Name));
4676
if (element.Mapping.
TypeDesc
!.IsValueType)
4678
Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.
TypeDesc
.CSharpName, element.Mapping.
TypeDesc
.UseReflection, false, false));
4690
if (element.Default != null && element.Default != DBNull.Value && element.Mapping.
TypeDesc
!.IsValueType)
4705
if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan) || element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset)
4706
|| element.Mapping.
TypeDesc
!.Type == typeof(DateOnly) || element.Mapping.
TypeDesc
!.Type == typeof(TimeOnly))
4712
if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan))
4716
else if (element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset))
4720
else if (element.Mapping.
TypeDesc
!.Type == typeof(DateOnly))
4724
else if (element.Mapping.
TypeDesc
!.Type == typeof(TimeOnly))
4744
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
4749
switch (element.Mapping.
TypeDesc
.FormatterName)
4790
if (mapping.
TypeDesc
!.IsValueType)
4798
WriteSourceBeginTyped(source, mapping.
TypeDesc
);
4802
WriteCatchCastException(mapping.
TypeDesc
, "rre", null);
4806
if (mapping.
TypeDesc
.IsValueType)
4817
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name));
4829
if (mapping.
TypeDesc
!.IsNullable)
4842
switch (special.
TypeDesc
!.Kind)
4845
bool isDoc = special.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
4846
WriteSourceBeginTyped(source, special.
TypeDesc
);
4867
WriteSourceBeginTyped(source, sm.
TypeDesc
);
4871
if (sm.
TypeDesc
!.CSharpName == "global::System.Xml.Linq.XElement")
4873
Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.
TypeDesc
!.CSharpName, false, false, false, "\"default\""));
4877
Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.
TypeDesc
!.CSharpName, sm.
TypeDesc
.UseReflection, sm.
TypeDesc
.CannotNew, false));
4910
string enumTypeName = choice.Mapping!.
TypeDesc
!.CSharpName;
4914
Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.
TypeDesc
.UseReflection));
4936
WriteSourceBeginTyped(source, head.
TypeDesc
);
4940
Writer.Write(RaCodeGen.GetStringForCreateInstance(derived.
TypeDesc
!.CSharpName, derived.
TypeDesc
.UseReflection, derived.
TypeDesc
.CannotNew, false));
5088
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
5089
bool useReflection = mapping.
TypeDesc
.UseReflection;
5090
bool ctorInaccessible = mapping.
TypeDesc
.CannotNew;
5104
Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.
TypeDesc
.CannotNew, true));
System\Xml\Serialization\XmlSerializationReaderILGen.cs (117)
92
string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName;
197
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
643
member.TypeDesc = mapping.
TypeDesc
;
684
if (enumMethodName == null) throw new InvalidOperationException(SR.Format(SR.XmlMissingMethodEnum, mapping.
TypeDesc
!.Name));
690
mapping.
TypeDesc
!.Type,
742
else if (mapping.
TypeDesc
== StringTypeDesc)
787
else if (mapping.
TypeDesc
!.FormatterName == "String")
792
if (mapping.
TypeDesc
.CollapseWhitespace)
797
if (mapping.
TypeDesc
.CollapseWhitespace)
821
if (mapping.
TypeDesc
.CollapseWhitespace)
826
if (mapping.
TypeDesc
.CollapseWhitespace)
841
if (mapping.
TypeDesc
.HasCustomFormatter)
845
if ((mapping.
TypeDesc
.FormatterName == "ByteArrayBase64" && source == "false")
846
|| (mapping.
TypeDesc
.FormatterName == "ByteArrayHex" && source == "false")
847
|| (mapping.
TypeDesc
.FormatterName == "XmlQualifiedName"))
854
$"To{mapping.
TypeDesc
.FormatterName}",
862
$"To{mapping.
TypeDesc
.FormatterName}",
992
ilg.Ldc(Enum.ToObject(mapping.
TypeDesc
!.Type!, constants[i].Value));
993
ilg.ConvertValue(mapping.
TypeDesc
.Type!, typeof(long));
1018
WriteHashtable(mapping, mapping.
TypeDesc
!.Name, out get_TableName);
1022
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
1028
returnType = mapping.
TypeDesc
.Type!;
1095
retValues.Add(Enum.ToObject(mapping.
TypeDesc
.Type!, c.Value));
1118
ilg.Ldc(mapping.
TypeDesc
.Type!);
1141
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
!.Name));
1146
if (derived.
TypeDesc
!.IsNullable)
1157
derived.
TypeDesc
.Type,
1196
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, enumMapping.
TypeDesc
!.Name));
1202
enumMapping.
TypeDesc
!.Type,
1238
if (arrayMapping.
TypeDesc
!.HasDefaultConstructor)
1245
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
1251
TypeDesc td = arrayMapping.
TypeDesc
;
1252
LocalBuilder aLoc = ilg.DeclareLocal(arrayMapping.
TypeDesc
.Type!, aVar);
1253
if (arrayMapping.
TypeDesc
.IsValueType)
1279
nullableMapping.
TypeDesc
!.Type!,
1285
LocalBuilder oLoc = ilg.DeclareLocal(nullableMapping.
TypeDesc
.Type!, "o");
1288
ilg.InitObj(nullableMapping.
TypeDesc
.Type!);
1306
element.IsNullable = nullableMapping.BaseMapping!.
TypeDesc
!.IsNullable;
1327
string typeName = structMapping.
TypeDesc
!.CSharpName;
1331
if (structMapping.
TypeDesc
.IsNullable)
1339
structMapping.
TypeDesc
.Type!,
1370
if (structMapping.
TypeDesc
.IsNullable)
1384
if (structMapping.
TypeDesc
.IsRoot)
1402
if (structMapping.
TypeDesc
.IsValueType)
1419
if (!structMapping.
TypeDesc
.IsRoot)
1433
if (structMapping.
TypeDesc
.IsRoot)
1452
WriteDerivedTypes(structMapping, !structMapping.
TypeDesc
.IsRoot, typeName);
1453
if (structMapping.
TypeDesc
.IsRoot) WriteEnumAndArrayTypes();
1455
if (structMapping.
TypeDesc
.IsRoot)
1483
if (structMapping.
TypeDesc
.IsNullable)
1495
if (structMapping.
TypeDesc
.IsAbstract)
1510
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
1567
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
1685
ilg.Ldloc(structMapping.
TypeDesc
.Type!, "o");
2036
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
2042
else if (special.
TypeDesc
.CanBeAttributeValue)
2142
WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName}[]",
2144
member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
2319
switch (special.
TypeDesc
!.Kind)
2352
WriteSourceEnd(member.ArraySource, special.
TypeDesc
.Type!);
2359
if (text.Mapping!.
TypeDesc
!.CollapseWhitespace)
2379
if (text.Mapping.
TypeDesc
.CollapseWhitespace)
2391
if (text.Mapping!.
TypeDesc
== StringTypeDesc || text.Mapping.
TypeDesc
!.FormatterName == "String")
2401
ilg.Ldc(text.Mapping.
TypeDesc
!.CollapseWhitespace);
2414
WriteSourceEnd(member.ArraySource, text.Mapping.
TypeDesc
.Type!);
2658
ilg.Ldc(member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.Type!);
2661
ilg.ConvertValue(XmlSerializationReader_ShrinkArray.ReturnType, member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.Type!.MakeArrayType());
2662
WriteSourceEnd(member.ChoiceSource!, member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.Type!.MakeArrayType());
2860
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
2978
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.
TypeDesc
!.Name));
2987
element.Mapping.
TypeDesc
!.Type,
2991
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type!);
3007
if (element.Mapping.
TypeDesc
!.IsValueType)
3015
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type!);
3019
if (element.Default != null && element.Default != DBNull.Value && element.Mapping.
TypeDesc
!.IsValueType)
3050
if ((element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan)) || element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset)
3051
|| element.Mapping.
TypeDesc
!.Type == typeof(DateOnly) || element.Mapping.
TypeDesc
!.Type == typeof(TimeOnly))
3076
LocalBuilder tmpLoc = ilg.GetTempLocal(element.Mapping.
TypeDesc
!.Type);
3078
ilg.InitObj(element.Mapping.
TypeDesc
!.Type);
3080
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type);
3084
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type);
3090
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
3103
switch (element.Mapping.
TypeDesc
.FormatterName)
3116
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type!);
3128
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name));
3154
if (mapping.
TypeDesc
!.IsNullable)
3164
mapping.
TypeDesc
.Type,
3168
WriteSourceEnd(source, mapping.
TypeDesc
.Type!);
3175
switch (special.
TypeDesc
!.Kind)
3178
bool isDoc = special.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
3189
if (special.
TypeDesc
!= null)
3190
ilg.Castclass(special.
TypeDesc
.Type!);
3191
WriteSourceEnd(source, special.
TypeDesc
!.Type!);
3229
ReflectionAwareILGen.ILGenForCreateInstance(ilg, sm.
TypeDesc
!.Type!, sm.
TypeDesc
.CannotNew, false);
3230
if (sm.
TypeDesc
.CannotNew)
3236
if (sm.
TypeDesc
!= null)
3237
ilg.ConvertValue(typeof(IXmlSerializable), sm.
TypeDesc
.Type!);
3238
WriteSourceEnd(source, sm.
TypeDesc
!.Type!);
3262
ReflectionAwareILGen.ILGenForEnumMember(ilg, choice.Mapping!.
TypeDesc
!.Type!, choice.MemberIds[elementIndex]);
3263
WriteSourceEnd(choiceSource!, choice.Mapping.
TypeDesc
.Type!);
3300
ReflectionAwareILGen.ILGenForCreateInstance(ilg, derived.
TypeDesc
!.Type!, derived.
TypeDesc
.CannotNew, false);
3301
if (derived.
TypeDesc
.CannotNew)
3307
if (head.
TypeDesc
!= null)
3308
ilg.ConvertValue(typeof(IXmlSerializable), head.
TypeDesc
.Type!);
3309
WriteSourceEnd(source, head.
TypeDesc
!.Type!);
3430
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3431
bool ctorInaccessible = mapping.
TypeDesc
.CannotNew;
3434
mapping.
TypeDesc
.Type!,
3441
ReflectionAwareILGen.ILGenForCreateInstance(ilg, mapping.
TypeDesc
.Type!, mapping.
TypeDesc
.CannotNew, true);
System\Xml\Serialization\XmlSerializationWriter.cs (118)
1743
string typeFullName = mapping.
TypeDesc
!.CSharpName;
1953
return $"{mapping.
TypeDesc
!.CSharpName}.@{memberName}";
1955
string memberAccess = GetStringForEnumMember(mapping.
TypeDesc
!.CSharpName, memberName, useReflection);
2311
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
2387
!typeMapping.
TypeDesc
!.IsRoot)
2391
Writer.Write(RaCodeGen.GetStringForTypeof(typeMapping.
TypeDesc
.CSharpName, typeMapping.
TypeDesc
.UseReflection));
2455
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name) + Environment.StackTrace);
2495
TypeDesc typeDesc = mapping.
TypeDesc
!;
2496
bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.
TypeDesc
!.HasDefaultSupport;
2507
if (mapping.
TypeDesc
!.UseReflection)
2508
Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue(source, mapping.
TypeDesc
.UseReflection));
2522
Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.
TypeDesc
.UseReflection));
2528
Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue!, mapping.
TypeDesc
.UseReflection));
2796
if (member.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection)
2887
if (!mapping.IsSoap && !mapping.
TypeDesc
!.IsValueType && !mapping.
TypeDesc
.Type!.IsPrimitive)
2892
WriteMember("o", null, new ElementAccessor[] { element }, null, null, mapping.
TypeDesc
!, !element.IsSoap);
2912
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
2918
WriteLocalDecl(fullTypeName, "v", "e", mapping.
TypeDesc
.UseReflection);
2925
Writer.Write(mapping.
TypeDesc
.UseReflection ? "object" : fullTypeName);
2935
if (mapping.
TypeDesc
.UseReflection)
2936
Writer.WriteLine($"switch ({ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.
TypeDesc
.UseReflection)} ){{");
2945
WriteEnumCase(fullTypeName, c, mapping.
TypeDesc
.UseReflection);
2957
Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.
TypeDesc
.UseReflection));
2977
if (mapping.
TypeDesc
.UseReflection)
2989
WriteQuotedCSharpString(mapping.
TypeDesc
.FullName);
2995
Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.
TypeDesc
.UseReflection));
2997
WriteQuotedCSharpString(mapping.
TypeDesc
.FullName);
3024
string fullTypeName = derived.
TypeDesc
!.CSharpName;
3026
WriteTypeCompare("t", fullTypeName, derived.
TypeDesc
.UseReflection);
3034
if (methodName == null) throw new InvalidOperationException("derived from " + mapping.
TypeDesc
!.FullName + ", " + SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
.Name) + Environment.StackTrace);
3039
if (!derived.
TypeDesc
.UseReflection) Writer.Write($"({fullTypeName})");
3041
if (derived.
TypeDesc
.IsNullable)
3063
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3065
WriteTypeCompare("t", fullTypeName, mapping.
TypeDesc
.UseReflection);
3073
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
.Name) + Environment.StackTrace);
3084
if (!mapping.
TypeDesc
.UseReflection) Writer.Write($"({fullTypeName})");
3095
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3097
if (mapping.
TypeDesc
.IsArray)
3098
WriteArrayTypeCompare("t", fullTypeName, mapping.
TypeDesc
.ArrayElementTypeDesc!.CSharpName, mapping.
TypeDesc
.UseReflection);
3100
WriteTypeCompare("t", fullTypeName, mapping.
TypeDesc
.UseReflection);
3111
WriteMember("o", null, mapping.ElementsSortedByDerivation!, null, null, mapping.
TypeDesc
, true);
3125
if (mapping.IsSoap && mapping.
TypeDesc
!.IsRoot) return;
3132
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3138
WriteLocalDecl(fullTypeName, "o", "s", mapping.
TypeDesc
.UseReflection);
3143
Writer.Write(mapping.
TypeDesc
.UseReflection ? "object" : fullTypeName);
3145
if (mapping.
TypeDesc
.IsNullable)
3149
if (mapping.
TypeDesc
.IsNullable)
3164
WriteTypeCompare("t", fullTypeName, mapping.
TypeDesc
.UseReflection);
3170
if (mapping.
TypeDesc
.IsRoot)
3173
if (mapping.
TypeDesc
.IsRoot)
3188
if (!mapping.
TypeDesc
.IsAbstract)
3190
if (mapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.
TypeDesc
.Type))
3202
xmlnsSource = RaCodeGen.GetStringForMember("o", member.Name, mapping.
TypeDesc
);
3203
if (mapping.
TypeDesc
.UseReflection)
3218
if (!mapping.
TypeDesc
.IsRoot)
3240
string methodInvoke = RaCodeGen.GetStringForMethodInvoke("o", fullTypeName, $"ShouldSerialize{m.Name}", mapping.
TypeDesc
.UseReflection);
3241
if (mapping.
TypeDesc
.UseReflection) methodInvoke = $"(({typeof(bool).FullName}){methodInvoke})";
3249
string memberGet = RaCodeGen.GetStringForMember("o", $"{m.Name}Specified", mapping.
TypeDesc
);
3250
if (mapping.
TypeDesc
.UseReflection) memberGet = $"(({typeof(bool).FullName}){memberGet})";
3255
WriteMember(RaCodeGen.GetStringForMember("o", m.Name, mapping.
TypeDesc
), m.Attribute, m.TypeDesc!, "o");
3281
string methodInvoke = RaCodeGen.GetStringForMethodInvoke("o", fullTypeName, $"ShouldSerialize{m.Name}", mapping.
TypeDesc
.UseReflection);
3282
if (mapping.
TypeDesc
.UseReflection) methodInvoke = $"(({typeof(bool).FullName}){methodInvoke})";
3290
string memberGet = RaCodeGen.GetStringForMember("o", $"{m.Name}Specified", mapping.
TypeDesc
);
3291
if (mapping.
TypeDesc
.UseReflection) memberGet = $"(({typeof(bool).FullName}){memberGet})";
3301
choiceSource = RaCodeGen.GetStringForMember("o", m.ChoiceIdentifier.MemberName, mapping.
TypeDesc
);
3303
WriteMember(RaCodeGen.GetStringForMember("o", m.Name, mapping.
TypeDesc
), choiceSource, m.ElementsSortedByDerivation!, m.Text, m.ChoiceIdentifier, m.TypeDesc!, true);
3511
if (special.
TypeDesc
!.Kind == TypeKind.Attribute || special.
TypeDesc
.CanBeAttributeValue)
3524
TypeDesc typeDesc = attribute.Mapping!.
TypeDesc
!;
3556
string choiceFullName = choice.Mapping!.
TypeDesc
!.CSharpName;
3557
WriteArrayLocalDecl($"{choiceFullName}[]", "c", choiceSource, choice.Mapping.
TypeDesc
);
3562
WriteQuotedCSharpString(choice.Mapping.
TypeDesc
.FullName);
3668
string choiceFullName = choice.Mapping!.
TypeDesc
!.CSharpName;
3669
WriteLocalDecl(choiceFullName, $"{choiceName}i", RaCodeGen.GetStringForArrayMember(choiceName!, $"i{arrayName}", choice.Mapping.
TypeDesc
), choice.Mapping.
TypeDesc
.UseReflection);
3694
TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : elements[0].Mapping!.
TypeDesc
!;
3695
if (!elements[0].Any && !elements[0].Mapping!.
TypeDesc
!.UseReflection && !elements[0].Mapping!.
TypeDesc
!.IsOptionalValue)
3713
string? enumTypeName = choice == null ? null : choice.Mapping!.
TypeDesc
!.FullName;
3733
bool useReflection = element.Mapping!.
TypeDesc
!.UseReflection;
3734
string fullTypeName = element.Mapping.
TypeDesc
.CSharpName;
3735
bool enumUseReflection = choice.Mapping!.
TypeDesc
!.UseReflection;
3753
WriteChoiceTypeCheck(source, fullTypeName, useReflection, choice, enumFullName, element.Mapping.
TypeDesc
);
3764
bool useReflection = element.Mapping!.
TypeDesc
!.UseReflection;
3765
TypeDesc td = element.IsUnbounded ? element.Mapping.
TypeDesc
.CreateArrayTypeDesc() : element.Mapping.
TypeDesc
;
3811
bool enumUseReflection = choice.Mapping!.
TypeDesc
!.UseReflection;
3877
bool useReflection = text.Mapping!.
TypeDesc
!.UseReflection;
3878
string fullTypeName = text.Mapping.
TypeDesc
.CSharpName;
3938
WritePrimitiveValue(primitive.
TypeDesc
!, source);
3944
switch (simple.
TypeDesc
!.Kind)
3967
string fullTypeName = element.Mapping.
TypeDesc
!.BaseTypeDesc!.CSharpName;
3969
if (!element.Mapping.
TypeDesc
.BaseTypeDesc.UseReflection)
3998
Writer.Write(RaCodeGen.GetStringForTypeof(arrayMapping.
TypeDesc
!.CSharpName, arrayMapping.
TypeDesc
.UseReflection));
4010
TypeDesc td = arrayMapping.
TypeDesc
!.CreateArrayTypeDesc();
4016
WriteArrayLocalDecl(fullTypeName, elementArrayName, source, arrayMapping.
TypeDesc
);
4023
if (arrayMapping.
TypeDesc
.IsNullable)
4071
string fullTypeName = arrayMapping.
TypeDesc
!.CSharpName;
4074
WriteArrayLocalDecl(fullTypeName, arrayName, source, arrayMapping.
TypeDesc
);
4081
if (arrayMapping.
TypeDesc
.IsNullable)
4091
WriteArrayItems(arrayMapping.ElementsSortedByDerivation!, null, null, arrayMapping.
TypeDesc
, arrayName, null);
4122
if (primitiveMapping.
TypeDesc
== QnameTypeDesc)
4127
string suffixRaw = primitiveMapping.
TypeDesc
!.XmlEncodingNotRequired ? "Raw" : "";
4145
Writer.Write(RaCodeGen.GetStringForTypeof(structMapping.
TypeDesc
!.CSharpName, structMapping.
TypeDesc
.UseReflection));
4160
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, structMapping.
TypeDesc
!.Name) + Environment.StackTrace);
4174
if (structMapping.
TypeDesc
!.IsNullable)
4263
Type? type = Type.GetType(mapping.
TypeDesc
!.Type!.FullName!);
4271
Type? type = Type.GetType(mapping.
TypeDesc
!.Type!.FullName!);
4553
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, choiceMapping.
TypeDesc
!.FullName));
4556
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, choiceMapping.
TypeDesc
!.FullName, $"{element.Namespace}:{element.Name}", element.Name, element.Namespace));
System\Xml\Serialization\XmlSerializationWriterILGen.cs (85)
41
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
110
source.Load(mapping.
TypeDesc
!.Type!);
111
argTypes.Add(mapping.
TypeDesc
.Type!);
127
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name));
136
new Type[] { mapping.
TypeDesc
!.Type! });
138
source.Load(mapping.
TypeDesc
.Type!);
193
TypeDesc typeDesc = mapping.
TypeDesc
!;
194
bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.
TypeDesc
!.HasDefaultSupport;
204
source.Load(mapping.
TypeDesc
!.Type!);
222
ilg.Ldc(Enum.Parse(mapping.
TypeDesc
.Type!, enumDefaultValue!, false));
574
if (!mapping.
TypeDesc
!.IsValueType && !mapping.
TypeDesc
.Type!.IsPrimitive)
585
WriteMember(new SourceInfo("o", "o", null, typeof(object), ilg), null, new ElementAccessor[] { element }, null, null, mapping.
TypeDesc
, true);
602
argTypes.Add(mapping.
TypeDesc
!.Type!);
624
LocalBuilder localTmp = ilg.DeclareLocal(mapping.
TypeDesc
.Type!, "localTmp");
634
ilg.Ldc(Enum.ToObject(mapping.
TypeDesc
.Type!, c.Value));
679
ilg.Ldstr(GetCSharpString(mapping.
TypeDesc
.FullName));
719
ilg.ConvertValue(mapping.
TypeDesc
.Type!, typeof(long));
726
ilg.Ldstr(GetCSharpString(mapping.
TypeDesc
.FullName));
741
WriteTypeCompare("t", derived.
TypeDesc
!.Type!);
748
if (methodName == null) throw new InvalidOperationException("derived from " + mapping.
TypeDesc
!.FullName + ", " + SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
.Name));
760
ilg.ConvertValue(oType, derived.
TypeDesc
.Type!);
761
argTypes.Add(derived.
TypeDesc
.Type!);
762
if (derived.
TypeDesc
.IsNullable)
791
WriteTypeCompare("t", mapping.
TypeDesc
!.Type!);
799
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
.Name));
829
new Type[] { mapping.
TypeDesc
.Type! }
841
ilg.ConvertValue(CodeGenerator.GetVariableType(oVar), mapping.
TypeDesc
.Type!);
859
if (mapping.
TypeDesc
!.IsArray)
860
WriteArrayTypeCompare("t", mapping.
TypeDesc
.Type!);
862
WriteTypeCompare("t", mapping.
TypeDesc
.Type!);
892
WriteMember(new SourceInfo("o", "o", null, null, ilg), null, mapping.ElementsSortedByDerivation!, null, null, mapping.
TypeDesc
, true);
921
argTypes.Add(mapping.
TypeDesc
!.Type!);
923
if (mapping.
TypeDesc
.IsNullable)
935
if (mapping.
TypeDesc
.IsNullable)
969
WriteTypeCompare("t", mapping.
TypeDesc
.Type!);
973
if (mapping.
TypeDesc
.IsRoot)
976
if (mapping.
TypeDesc
.IsRoot)
1007
if (!mapping.
TypeDesc
.IsAbstract)
1009
if (mapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.
TypeDesc
.Type))
1052
if (!mapping.
TypeDesc
.IsRoot)
1360
if (special.
TypeDesc
!.Kind == TypeKind.Attribute || special.
TypeDesc
.CanBeAttributeValue)
1379
TypeDesc typeDesc = attribute.Mapping!.
TypeDesc
!;
1432
string choiceFullName = choice.Mapping!.
TypeDesc
!.CSharpName;
1434
cName = $"c{choice.Mapping.
TypeDesc
.Name}";
1435
WriteArrayLocalDecl($"{choiceFullName}[]", cName, choiceSourceInfo, choice.Mapping.
TypeDesc
);
1459
ilg.Ldstr(GetCSharpString(choice.Mapping.
TypeDesc
.FullName));
1552
WriteLocalDecl($"{choiceName}i", ReflectionAwareILGen.GetStringForArrayMember(choiceName, iPlusArrayName), choice.Mapping!.
TypeDesc
!.Type!);
1569
TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : elements[0].Mapping!.
TypeDesc
!;
1570
if (!elements[0].Any && !elements[0].Mapping!.
TypeDesc
!.IsOptionalValue)
1588
string? enumTypeName = choice == null ? null : choice.Mapping!.
TypeDesc
!.FullName;
1613
ILGenLoad(enumSource!, choice == null ? null : choice.Mapping!.
TypeDesc
!.Type);
1631
WriteChoiceTypeCheck(source, choice!, enumFullName, element.Mapping!.
TypeDesc
!);
1633
SourceInfo castedSource = source.CastTo(element.Mapping.
TypeDesc
!);
1638
TypeDesc td = element.IsUnbounded ? element.Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : element.Mapping!.
TypeDesc
!;
1690
ILGenLoad(enumSource!, choice == null ? null : choice.Mapping!.
TypeDesc
!.Type);
1807
WriteInstanceOf(source, text.Mapping!.
TypeDesc
!.Type!);
1809
SourceInfo castedSource = source.CastTo(text.Mapping.
TypeDesc
);
1814
SourceInfo castedSource = source.CastTo(text.Mapping!.
TypeDesc
!);
1861
WritePrimitiveValue(primitiveMapping.
TypeDesc
!, source, out argType);
1872
switch (specialMapping.
TypeDesc
!.Kind)
1902
if (source.Type == element.Mapping.
TypeDesc
!.Type)
1904
MethodInfo Nullable_get_HasValue = element.Mapping.
TypeDesc
.Type!.GetMethod(
1909
source.LoadAddress(element.Mapping.
TypeDesc
.Type);
1919
SourceInfo castedSource = source.CastTo(element.Mapping.
TypeDesc
.BaseTypeDesc!);
1939
string fullTypeName = arrayMapping.
TypeDesc
!.CSharpName;
1940
WriteArrayLocalDecl(fullTypeName, arrayName, source, arrayMapping.
TypeDesc
);
1947
if (arrayMapping.
TypeDesc
.IsNullable)
1955
WriteArrayItems(arrayMapping.ElementsSortedByDerivation!, null, null, arrayMapping.
TypeDesc
, arrayName, null);
1963
if (arrayMapping.
TypeDesc
.IsNullable)
1977
if (primitiveMapping.
TypeDesc
== QnameTypeDesc)
1983
string suffixRaw = primitiveMapping.
TypeDesc
!.XmlEncodingNotRequired ? "Raw" : "";
1994
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, structMapping.
TypeDesc
!.Name));
2002
source.Load(structMapping.
TypeDesc
!.Type);
2003
argTypes.Add(structMapping.
TypeDesc
.Type!);
2004
if (structMapping.
TypeDesc
.IsNullable)
2253
eValue = Enum.ToObject(choiceMapping.
TypeDesc
!.Type!, choiceMapping.Constants[i].Value);
2267
eValue = Enum.ToObject(choiceMapping.
TypeDesc
!.Type!, choiceMapping.Constants[i].Value);
2277
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, choiceMapping.
TypeDesc
!.FullName));
2280
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, choiceMapping.
TypeDesc
!.FullName, $"{element.Namespace}:{element.Name}", element.Name, element.Namespace));
System\Xml\Serialization\XmlTypeMapping.cs (2)
30
return Mapping!.
TypeDesc
!.Name;
41
return Mapping!.
TypeDesc
!.FullName;