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;
1096
mapping.
TypeDesc
= model.TypeDesc;
1165
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, XmlSchema.Namespace);
1169
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, UrtTypes.Namespace);
1178
mapping.
TypeDesc
= model.TypeDesc;
1202
mapping.
TypeDesc
= model.TypeDesc;
1250
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;
678 references to TypeDesc
System.Private.Xml (678)
System\Xml\Serialization\Compilation.cs (1)
455
VerifyLoadContext(mapping.Accessor.Mapping?.
TypeDesc
?.Type, mainAssembly);
System\Xml\Serialization\Mappings.cs (15)
617
if (BaseMapping == null || BaseMapping.
TypeDesc
!.IsRoot)
626
throw new InvalidOperationException(SR.Format(SR.XmlIllegalSimpleContentExtension,
TypeDesc
!.FullName, BaseMapping.
TypeDesc
.FullName));
637
if (!_hasSimpleContent && text != null && !text.Mapping!.
TypeDesc
!.CanBeTextValue && !(BaseMapping != null && !BaseMapping.
TypeDesc
!.IsRoot && (text.Mapping.
TypeDesc
.IsEnum || text.Mapping.
TypeDesc
.IsPrimitive)))
639
throw new InvalidOperationException(SR.Format(SR.XmlIllegalTypedTextAttribute,
TypeDesc
!.FullName, text.Name, text.Mapping.
TypeDesc
.FullName));
660
if (
TypeDesc
!.IsRoot)
666
while (start.BaseMapping != null && !start.BaseMapping.IsSequence && !start.BaseMapping.
TypeDesc
!.IsRoot)
678
get { return _isSequence && !
TypeDesc
!.IsRoot; }
756
int w1 = a1.Mapping!.
TypeDesc
!.Weight;
757
int w2 = a2.Mapping!.
TypeDesc
!.Weight;
1083
throw new InvalidOperationException(SR.Format(SR.XmlCircularDerivation,
TypeDesc
!.FullName));
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (61)
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)
885
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
891
if (element.Mapping.
TypeDesc
.FormatterName == "ByteArrayBase64")
895
else if (element.Mapping.
TypeDesc
.FormatterName == "ByteArrayHex")
916
if (!mapping.
TypeDesc
!.IsValueType || rre != null)
943
isNullable: mapping.
TypeDesc
!.IsNullable && element.IsNullable,
952
switch (specialMapping.
TypeDesc
!.Kind)
955
bool isDoc = specialMapping.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
985
value = ReadSerializable((IXmlSerializable)ReflectionCreateObject(sm.
TypeDesc
!.Type!)!, isWrappedAny);
1025
object? WriteStruct() => WriteStructMethod(structMapping, mapping.
TypeDesc
!.IsNullable, true, defaultNamespace: null);
1075
return mapping.
TypeDesc
!.CanBeElementValue;
1093
TypeDesc td = arrayMapping.
TypeDesc
!;
1125
TypeDesc = arrayMapping.
TypeDesc
,
1172
else if (mapping.
TypeDesc
== StringTypeDesc)
1176
else if (mapping.
TypeDesc
!.FormatterName == "String")
1178
if (mapping.
TypeDesc
.CollapseWhitespace)
1189
if (!mapping.
TypeDesc
.HasCustomFormatter)
1192
object retObj = mapping.
TypeDesc
.FormatterName switch
1210
_ => throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorDetails, $"unknown FormatterName: {mapping.
TypeDesc
.FormatterName}")),
1216
string methodName = $"To{mapping.
TypeDesc
.FormatterName}";
1220
throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorDetails, $"unknown FormatterName: {mapping.
TypeDesc
.FormatterName}"));
1238
object? o = Activator.CreateInstance(nullableMapping.
TypeDesc
!.Type!);
1244
element.IsNullable = nullableMapping.BaseMapping!.
TypeDesc
!.IsNullable;
1270
return Enum.ToObject(mapping.
TypeDesc
!.Type!, ToEnum(source, table, mapping.
TypeDesc
.Name));
1278
return Enum.Parse(mapping.
TypeDesc
!.Type!, c.Name);
1282
throw CreateUnknownConstantException(source, mapping.
TypeDesc
!.Type!);
1330
if (structMapping.
TypeDesc
!.IsRoot)
1335
if (structMapping.
TypeDesc
.IsAbstract)
1341
object? o = ReflectionCreateObject(structMapping.
TypeDesc
.Type!);
1513
if (structMapping.
TypeDesc
!.IsRoot && isNull)
1521
if (structMapping.
TypeDesc
.IsValueType)
1523
return ReflectionCreateObject(structMapping.
TypeDesc
.Type!);
1533
if (xsiType == null || (!structMapping.
TypeDesc
.IsRoot && QNameEqual(xsiType, structMapping.TypeName, defaultNamespace)))
1535
if (structMapping.
TypeDesc
.IsRoot)
1544
else if (structMapping.
TypeDesc
.IsRoot && WriteEnumAndArrayTypes(out o, xsiType, defaultNamespace))
1550
if (structMapping.
TypeDesc
.IsRoot)
1557
if (structMapping.
TypeDesc
!.IsNullable && isNull)
1561
else if (structMapping.
TypeDesc
.IsAbstract)
1567
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
1574
object? o = ReflectionCreateObject(structMapping.
TypeDesc
.Type!)!;
1629
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
1705
object choiceValue = Enum.Parse(choice.Mapping!.
TypeDesc
!.Type!, name);
1917
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
1921
else if (special.
TypeDesc
.CanBeAttributeValue)
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (34)
46
!mapping.
TypeDesc
!.IsRoot)
49
mapping.
TypeDesc
.Type!,
52
CreateXmlSerializationWriteCallback(mapping, mapping.TypeName!, mapping.Namespace, mapping.
TypeDesc
.IsNullable)
104
if (!mapping.
TypeDesc
!.IsValueType && !mapping.
TypeDesc
.Type!.IsPrimitive)
109
WriteMember(o, null, new ElementAccessor[] { element }, null, null, mapping.
TypeDesc
, !element.IsSoap);
145
throw CreateInvalidChoiceIdentifierValueException(choice.Mapping!.
TypeDesc
!.FullName, choice.MemberName!);
219
if (o != null && o.GetType() == element.Mapping!.
TypeDesc
!.Type)
227
TypeDesc td = element.IsUnbounded ? element.Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : element.Mapping!.
TypeDesc
!;
251
throw CreateChoiceIdentifierValueException(choice.Mapping!.
TypeDesc
!.FullName, choice.MemberName!, elem.Name, elem.NamespaceURI);
288
if (!WritePrimitiveValue(primitiveMapping.
TypeDesc
!, o, out stringValue))
305
switch (specialMapping.
TypeDesc
!.Kind)
350
WritePotentiallyReferencingElement(name, ns, o, mapping.
TypeDesc
!.Type, true, element.IsNullable);
393
if (mapping!.
TypeDesc
== ReflectionXmlSerializationReader.QnameTypeDesc)
411
WritePrimitiveMethodRequirement suffixRaw = mapping.
TypeDesc
!.XmlEncodingNotRequired ? WritePrimitiveMethodRequirement.Raw : WritePrimitiveMethodRequirement.None;
423
WritePotentiallyReferencingElement(name, ns, o, !writeAccessor ? mapping.
TypeDesc
!.Type : null, !writeAccessor, element.IsNullable);
479
bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.
TypeDesc
!.HasDefaultSupport;
509
if (mapping.IsSoap && mapping.
TypeDesc
!.IsRoot) return;
520
&& o.GetType() != mapping.
TypeDesc
!.Type)
527
if (mapping.
TypeDesc
.IsRoot)
542
if (!mapping.
TypeDesc
!.IsAbstract)
544
if (mapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.
TypeDesc
.Type))
562
if (!mapping.
TypeDesc
.IsRoot)
666
if (m is EnumMapping em && em.
TypeDesc
!.Type == objType)
675
if (m is ArrayMapping am && am.
TypeDesc
!.Type == objType)
679
WriteMember(o, null, am.ElementsSortedByDerivation!, null, null, am.
TypeDesc
!, true);
726
throw CreateInvalidEnumValueException(v, mapping.
TypeDesc
!.FullName);
877
if (special.
TypeDesc
!.Kind == TypeKind.Attribute || special.
TypeDesc
.CanBeAttributeValue)
911
if (t == derived.
TypeDesc
!.Type)
928
TypeDesc typeDesc = mapping.
TypeDesc
!;
929
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)
735
if (typeMapping.
TypeDesc
== typeDesc)
1130
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));
873
if (!member.Text.Mapping!.
TypeDesc
!.CanBeTextValue && member.Text.Mapping.IsList)
874
throw new InvalidOperationException(SR.Format(SR.XmlIllegalTypedTextAttribute, typeName, member.Text.Name, member.Text.Mapping.
TypeDesc
.FullName));
1045
name = itemTypeMapping.
TypeDesc
!.DataType!.Name;
1047
else if (itemTypeMapping is StructMapping && itemTypeMapping.
TypeDesc
!.IsRoot)
1121
if (existingMapping.
TypeDesc
== model.TypeDesc)
1166
if (mapping.
TypeDesc
== null)
1170
if (mapping.
TypeDesc
== null)
1180
mapping.TypeName = mapping.
TypeDesc
.DataType!.Name;
1181
mapping.Namespace = mapping.
TypeDesc
.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
1183
CheckContext(mapping.
TypeDesc
, context);
1827
if (element.Mapping.
TypeDesc
!.Kind == TypeKind.Node)
2027
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, accessor.ChoiceIdentifier.Mapping!.
TypeDesc
!.FullName));
2033
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, accessor.ChoiceIdentifier.Mapping!.
TypeDesc
!.FullName, id, element.Name, element.Namespace));
2239
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;
440
type.IsMixed = mapping.
TypeDesc
.IsMixed;
576
if (mapping.
TypeDesc
!.IsXsdType)
578
qname = new XmlQualifiedName(mapping.
TypeDesc
.DataType!.Name, XmlSchema.Namespace);
728
if (!accessor.HasDefault && !valueTypeOptional && accessor.Mapping!.
TypeDesc
!.IsValueType)
815
int minOccurs = repeats || accessor.HasDefault || (!accessor.IsNullable && !accessor.Mapping!.
TypeDesc
!.IsValueType) || valueTypeOptional ? 0 : 1;
893
return val != 0 ? XmlCustomFormatter.FromEnum(val, names, ids, mapping.
TypeDesc
!.FullName) : null;
910
if (!pm.
TypeDesc
!.HasCustomFormatter)
914
if (pm.
TypeDesc
.Type == null)
916
throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorDetails, "Mapping for " + pm.
TypeDesc
.Name + " missing type property"));
920
if (pm.
TypeDesc
.FormatterName == "String")
924
System.Reflection.MethodInfo? format = formatter.GetMethod("ToString", new Type[] { pm.
TypeDesc
.Type! });
930
string defaultValue = XmlCustomFormatter.FromDefaultValue(value, pm.
TypeDesc
.FormatterName!);
932
throw new InvalidOperationException(SR.Format(SR.XmlInvalidDefaultValue, value, pm.
TypeDesc
.Name));
935
throw new InvalidOperationException(SR.Format(SR.XmlInvalidDefaultValue, value, pm.
TypeDesc
.Name));
944
if (mapping is StructMapping && mapping.
TypeDesc
!.IsRoot)
961
if (mapping.
TypeDesc
!.IsRoot)
969
throw new InvalidOperationException(SR.Format(SR.XmlCircularReference2, mapping.
TypeDesc
.Name, "AnonymousType", "false"));
975
if (!mapping.IncludeInSchema) throw new InvalidOperationException(SR.Format(SR.XmlCannotIncludeInSchema, mapping.
TypeDesc
.Name));
984
type.IsAbstract = mapping.
TypeDesc
.IsAbstract;
990
throw new InvalidOperationException(SR.Format(SR.XmlAnonymousBaseType, mapping.
TypeDesc
.Name, mapping.BaseMapping.
TypeDesc
!.Name, "AnonymousType", "false"));
1096
throw new InvalidOperationException(SR.Format(SR.XmlAnonymousBaseType, textMapping.
TypeDesc
!.Name, pm.
TypeDesc
!.Name, "AnonymousType", "false"));
1143
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 (123)
2131
bool choiceUseReflection = mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection;
2132
string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.
TypeDesc
.CSharpName;
2136
_choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, $"{c}++", mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
2245
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
2391
!mapping.
TypeDesc
!.IsRoot)
2407
Writer.Write(RaCodeGen.GetStringForTypeof(mapping.
TypeDesc
.CSharpName, mapping.
TypeDesc
.UseReflection));
2797
member.TypeDesc = mapping.
TypeDesc
;
2826
if (enumMethodName == null) throw new InvalidOperationException(SR.Format(SR.XmlMissingMethodEnum, mapping.
TypeDesc
!.Name));
2831
Writer.Write(mapping.
TypeDesc
!.CSharpName);
2839
else if (mapping.
TypeDesc
== StringTypeDesc)
2843
else if (mapping.
TypeDesc
!.FormatterName == "String")
2845
if (mapping.
TypeDesc
.CollapseWhitespace)
2858
if (!mapping.
TypeDesc
.HasCustomFormatter)
2864
Writer.Write(mapping.
TypeDesc
.FormatterName);
2935
if (!mapping.
TypeDesc
!.UseReflection)
2938
Writer.Write(mapping.
TypeDesc
.CSharpName);
2975
tableName = WriteHashtable(mapping, mapping.
TypeDesc
!.Name);
2979
bool useReflection = mapping.
TypeDesc
!.UseReflection;
2980
string fullTypeName = mapping.
TypeDesc
.CSharpName;
3070
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
!.Name));
3074
if (derived.
TypeDesc
!.UseReflection && isTypedReturn)
3078
if (derived.
TypeDesc
.IsNullable)
3107
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, enumMapping.
TypeDesc
!.Name));
3119
if (arrayMapping.
TypeDesc
!.HasDefaultConstructor)
3126
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
3130
TypeDesc td = arrayMapping.
TypeDesc
;
3131
string fullTypeName = arrayMapping.
TypeDesc
.CSharpName;
3142
if (arrayMapping.
TypeDesc
.IsValueType)
3163
bool useReflection = nullableMapping.BaseMapping!.
TypeDesc
!.UseReflection;
3164
string typeName = useReflection ? "object" : nullableMapping.
TypeDesc
!.CSharpName;
3197
element.IsNullable = nullableMapping.BaseMapping.
TypeDesc
.IsNullable;
3217
bool useReflection = structMapping.
TypeDesc
!.UseReflection;
3218
string typeName = useReflection ? "object" : structMapping.
TypeDesc
.CSharpName;
3224
if (structMapping.
TypeDesc
.IsNullable)
3232
if (structMapping.
TypeDesc
.IsNullable)
3236
if (structMapping.
TypeDesc
.IsRoot)
3243
if (structMapping.
TypeDesc
.IsValueType)
3245
Writer.Write(RaCodeGen.GetStringForCreateInstance(structMapping.
TypeDesc
.CSharpName, useReflection, false, false));
3255
if (!structMapping.
TypeDesc
.IsRoot)
3261
if (structMapping.
TypeDesc
.IsRoot)
3270
WriteDerivedTypes(structMapping, !useReflection && !structMapping.
TypeDesc
.IsRoot, typeName);
3271
if (structMapping.
TypeDesc
.IsRoot) WriteEnumAndArrayTypes();
3272
if (structMapping.
TypeDesc
.IsRoot)
3280
if (structMapping.
TypeDesc
.IsRoot)
3283
if (structMapping.
TypeDesc
.IsNullable)
3286
if (structMapping.
TypeDesc
.IsAbstract)
3296
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
3317
string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.
TypeDesc
);
3318
Member member = new Member(this, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3323
member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", $"{mapping.Name}Specified", structMapping.
TypeDesc
);
3344
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
3348
Member arrayMember = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3421
if (structMapping.
TypeDesc
!.IsRoot)
3436
if (structMapping.
TypeDesc
.IsAbstract)
3457
string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.
TypeDesc
);
3458
Member member = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3460
member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", $"{mapping.Name}Specified", structMapping.
TypeDesc
);
3492
if (anyFixups) WriteFixupMethod(fixupMethodName, members, structMapping.
TypeDesc
.CSharpName, structMapping.
TypeDesc
.UseReflection, true, "o");
3799
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
3806
else if (special.
TypeDesc
.CanBeAttributeValue)
3921
WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName}[]",
3923
member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
4078
WriteSourceBeginTyped(member.ArraySource, special.
TypeDesc
);
4079
switch (special.
TypeDesc
!.Kind)
4094
if (text.Mapping!.
TypeDesc
!.CollapseWhitespace)
4105
if (text.Mapping!.
TypeDesc
== StringTypeDesc || text.Mapping.
TypeDesc
!.FormatterName == "String")
4108
if (text.Mapping.
TypeDesc
!.CollapseWhitespace)
4248
TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.
TypeDesc
!;
4253
Writer.Write(RaCodeGen.GetStringForTypeof(e.Mapping!.
TypeDesc
!.CSharpName, e.Mapping.
TypeDesc
.UseReflection));
4278
if (e.Mapping!.
TypeDesc
!.IsValueType || e.Mapping is NullableMapping)
4288
TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.
TypeDesc
!;
4289
Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.
TypeDesc
.CSharpName, e.Mapping.
TypeDesc
.UseReflection, false, true, $"({td.CSharpName}){checkTypeSource}"));
4293
WriteSourceBeginTyped(member.ArraySource, e.Mapping.
TypeDesc
);
4298
if (e.Mapping.
TypeDesc
.IsValueType)
4460
bool choiceUseReflection = member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection;
4461
string choiceTypeName = member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.CSharpName;
4535
TypeDesc td = arrayMapping.
TypeDesc
!;
4548
WriteSourceBeginTyped(source, arrayMapping.
TypeDesc
);
4552
WriteCatchCastException(arrayMapping.
TypeDesc
!, "rre", null);
4562
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
4635
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.
TypeDesc
!.Name));
4650
if (element.Mapping.
TypeDesc
!.IsValueType)
4652
Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.
TypeDesc
.CSharpName, element.Mapping.
TypeDesc
.UseReflection, false, false));
4664
if (element.Default != null && element.Default != DBNull.Value && element.Mapping.
TypeDesc
!.IsValueType)
4679
if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan) || element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset))
4685
if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan))
4689
else if (element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset))
4709
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
4714
switch (element.Mapping.
TypeDesc
.FormatterName)
4755
if (mapping.
TypeDesc
!.IsValueType)
4763
WriteSourceBeginTyped(source, mapping.
TypeDesc
);
4767
WriteCatchCastException(mapping.
TypeDesc
, "rre", null);
4771
if (mapping.
TypeDesc
.IsValueType)
4782
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name));
4794
if (mapping.
TypeDesc
!.IsNullable)
4807
switch (special.
TypeDesc
!.Kind)
4810
bool isDoc = special.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
4811
WriteSourceBeginTyped(source, special.
TypeDesc
);
4832
WriteSourceBeginTyped(source, sm.
TypeDesc
);
4836
if (sm.
TypeDesc
!.CSharpName == "global::System.Xml.Linq.XElement")
4838
Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.
TypeDesc
!.CSharpName, false, false, false, "\"default\""));
4842
Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.
TypeDesc
!.CSharpName, sm.
TypeDesc
.UseReflection, sm.
TypeDesc
.CannotNew, false));
4875
string enumTypeName = choice.Mapping!.
TypeDesc
!.CSharpName;
4879
Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.
TypeDesc
.UseReflection));
4901
WriteSourceBeginTyped(source, head.
TypeDesc
);
4905
Writer.Write(RaCodeGen.GetStringForCreateInstance(derived.
TypeDesc
!.CSharpName, derived.
TypeDesc
.UseReflection, derived.
TypeDesc
.CannotNew, false));
5053
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
5054
bool useReflection = mapping.
TypeDesc
.UseReflection;
5055
bool ctorInaccessible = mapping.
TypeDesc
.CannotNew;
5069
Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.
TypeDesc
.CannotNew, true));
System\Xml\Serialization\XmlSerializationReaderILGen.cs (115)
93
string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName;
198
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
644
member.TypeDesc = mapping.
TypeDesc
;
685
if (enumMethodName == null) throw new InvalidOperationException(SR.Format(SR.XmlMissingMethodEnum, mapping.
TypeDesc
!.Name));
691
mapping.
TypeDesc
!.Type,
743
else if (mapping.
TypeDesc
== StringTypeDesc)
788
else if (mapping.
TypeDesc
!.FormatterName == "String")
793
if (mapping.
TypeDesc
.CollapseWhitespace)
798
if (mapping.
TypeDesc
.CollapseWhitespace)
822
if (mapping.
TypeDesc
.CollapseWhitespace)
827
if (mapping.
TypeDesc
.CollapseWhitespace)
842
if (mapping.
TypeDesc
.HasCustomFormatter)
846
if ((mapping.
TypeDesc
.FormatterName == "ByteArrayBase64" && source == "false")
847
|| (mapping.
TypeDesc
.FormatterName == "ByteArrayHex" && source == "false")
848
|| (mapping.
TypeDesc
.FormatterName == "XmlQualifiedName"))
855
$"To{mapping.
TypeDesc
.FormatterName}",
863
$"To{mapping.
TypeDesc
.FormatterName}",
993
ilg.Ldc(Enum.ToObject(mapping.
TypeDesc
!.Type!, constants[i].Value));
994
ilg.ConvertValue(mapping.
TypeDesc
.Type!, typeof(long));
1019
WriteHashtable(mapping, mapping.
TypeDesc
!.Name, out get_TableName);
1023
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
1029
returnType = mapping.
TypeDesc
.Type!;
1096
retValues.Add(Enum.ToObject(mapping.
TypeDesc
.Type!, c.Value));
1119
ilg.Ldc(mapping.
TypeDesc
.Type!);
1142
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
!.Name));
1147
if (derived.
TypeDesc
!.IsNullable)
1158
derived.
TypeDesc
.Type,
1197
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, enumMapping.
TypeDesc
!.Name));
1203
enumMapping.
TypeDesc
!.Type,
1239
if (arrayMapping.
TypeDesc
!.HasDefaultConstructor)
1246
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
1252
TypeDesc td = arrayMapping.
TypeDesc
;
1253
LocalBuilder aLoc = ilg.DeclareLocal(arrayMapping.
TypeDesc
.Type!, aVar);
1254
if (arrayMapping.
TypeDesc
.IsValueType)
1280
nullableMapping.
TypeDesc
!.Type!,
1286
LocalBuilder oLoc = ilg.DeclareLocal(nullableMapping.
TypeDesc
.Type!, "o");
1289
ilg.InitObj(nullableMapping.
TypeDesc
.Type!);
1307
element.IsNullable = nullableMapping.BaseMapping!.
TypeDesc
!.IsNullable;
1328
string typeName = structMapping.
TypeDesc
!.CSharpName;
1332
if (structMapping.
TypeDesc
.IsNullable)
1340
structMapping.
TypeDesc
.Type!,
1371
if (structMapping.
TypeDesc
.IsNullable)
1385
if (structMapping.
TypeDesc
.IsRoot)
1403
if (structMapping.
TypeDesc
.IsValueType)
1420
if (!structMapping.
TypeDesc
.IsRoot)
1434
if (structMapping.
TypeDesc
.IsRoot)
1453
WriteDerivedTypes(structMapping, !structMapping.
TypeDesc
.IsRoot, typeName);
1454
if (structMapping.
TypeDesc
.IsRoot) WriteEnumAndArrayTypes();
1456
if (structMapping.
TypeDesc
.IsRoot)
1484
if (structMapping.
TypeDesc
.IsNullable)
1496
if (structMapping.
TypeDesc
.IsAbstract)
1511
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
1568
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
1686
ilg.Ldloc(structMapping.
TypeDesc
.Type!, "o");
2037
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
2043
else if (special.
TypeDesc
.CanBeAttributeValue)
2143
WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName}[]",
2145
member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
2320
switch (special.
TypeDesc
!.Kind)
2353
WriteSourceEnd(member.ArraySource, special.
TypeDesc
.Type!);
2360
if (text.Mapping!.
TypeDesc
!.CollapseWhitespace)
2380
if (text.Mapping.
TypeDesc
.CollapseWhitespace)
2392
if (text.Mapping!.
TypeDesc
== StringTypeDesc || text.Mapping.
TypeDesc
!.FormatterName == "String")
2402
ilg.Ldc(text.Mapping.
TypeDesc
!.CollapseWhitespace);
2415
WriteSourceEnd(member.ArraySource, text.Mapping.
TypeDesc
.Type!);
2659
ilg.Ldc(member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.Type!);
2662
ilg.ConvertValue(XmlSerializationReader_ShrinkArray.ReturnType, member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.Type!.MakeArrayType());
2663
WriteSourceEnd(member.ChoiceSource!, member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.Type!.MakeArrayType());
2861
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
2979
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.
TypeDesc
!.Name));
2988
element.Mapping.
TypeDesc
!.Type,
2992
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type!);
3008
if (element.Mapping.
TypeDesc
!.IsValueType)
3016
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type!);
3020
if (element.Default != null && element.Default != DBNull.Value && element.Mapping.
TypeDesc
!.IsValueType)
3051
if ((element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan)) || element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset))
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)
1696
string typeFullName = mapping.
TypeDesc
!.CSharpName;
1906
return $"{mapping.
TypeDesc
!.CSharpName}.@{memberName}";
1908
string memberAccess = GetStringForEnumMember(mapping.
TypeDesc
!.CSharpName, memberName, useReflection);
2264
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
2340
!typeMapping.
TypeDesc
!.IsRoot)
2344
Writer.Write(RaCodeGen.GetStringForTypeof(typeMapping.
TypeDesc
.CSharpName, typeMapping.
TypeDesc
.UseReflection));
2408
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name) + Environment.StackTrace);
2448
TypeDesc typeDesc = mapping.
TypeDesc
!;
2449
bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.
TypeDesc
!.HasDefaultSupport;
2460
if (mapping.
TypeDesc
!.UseReflection)
2461
Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue(source, mapping.
TypeDesc
.UseReflection));
2475
Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.
TypeDesc
.UseReflection));
2481
Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue!, mapping.
TypeDesc
.UseReflection));
2749
if (member.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection)
2840
if (!mapping.IsSoap && !mapping.
TypeDesc
!.IsValueType && !mapping.
TypeDesc
.Type!.IsPrimitive)
2845
WriteMember("o", null, new ElementAccessor[] { element }, null, null, mapping.
TypeDesc
!, !element.IsSoap);
2865
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
2871
WriteLocalDecl(fullTypeName, "v", "e", mapping.
TypeDesc
.UseReflection);
2878
Writer.Write(mapping.
TypeDesc
.UseReflection ? "object" : fullTypeName);
2888
if (mapping.
TypeDesc
.UseReflection)
2889
Writer.WriteLine($"switch ({ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.
TypeDesc
.UseReflection)} ){{");
2898
WriteEnumCase(fullTypeName, c, mapping.
TypeDesc
.UseReflection);
2910
Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.
TypeDesc
.UseReflection));
2930
if (mapping.
TypeDesc
.UseReflection)
2942
WriteQuotedCSharpString(mapping.
TypeDesc
.FullName);
2948
Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.
TypeDesc
.UseReflection));
2950
WriteQuotedCSharpString(mapping.
TypeDesc
.FullName);
2977
string fullTypeName = derived.
TypeDesc
!.CSharpName;
2979
WriteTypeCompare("t", fullTypeName, derived.
TypeDesc
.UseReflection);
2987
if (methodName == null) throw new InvalidOperationException("derived from " + mapping.
TypeDesc
!.FullName + ", " + SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
.Name) + Environment.StackTrace);
2992
if (!derived.
TypeDesc
.UseReflection) Writer.Write($"({fullTypeName})");
2994
if (derived.
TypeDesc
.IsNullable)
3016
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3018
WriteTypeCompare("t", fullTypeName, mapping.
TypeDesc
.UseReflection);
3026
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
.Name) + Environment.StackTrace);
3037
if (!mapping.
TypeDesc
.UseReflection) Writer.Write($"({fullTypeName})");
3048
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3050
if (mapping.
TypeDesc
.IsArray)
3051
WriteArrayTypeCompare("t", fullTypeName, mapping.
TypeDesc
.ArrayElementTypeDesc!.CSharpName, mapping.
TypeDesc
.UseReflection);
3053
WriteTypeCompare("t", fullTypeName, mapping.
TypeDesc
.UseReflection);
3064
WriteMember("o", null, mapping.ElementsSortedByDerivation!, null, null, mapping.
TypeDesc
, true);
3078
if (mapping.IsSoap && mapping.
TypeDesc
!.IsRoot) return;
3085
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3091
WriteLocalDecl(fullTypeName, "o", "s", mapping.
TypeDesc
.UseReflection);
3096
Writer.Write(mapping.
TypeDesc
.UseReflection ? "object" : fullTypeName);
3098
if (mapping.
TypeDesc
.IsNullable)
3102
if (mapping.
TypeDesc
.IsNullable)
3117
WriteTypeCompare("t", fullTypeName, mapping.
TypeDesc
.UseReflection);
3123
if (mapping.
TypeDesc
.IsRoot)
3126
if (mapping.
TypeDesc
.IsRoot)
3141
if (!mapping.
TypeDesc
.IsAbstract)
3143
if (mapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.
TypeDesc
.Type))
3155
xmlnsSource = RaCodeGen.GetStringForMember("o", member.Name, mapping.
TypeDesc
);
3156
if (mapping.
TypeDesc
.UseReflection)
3171
if (!mapping.
TypeDesc
.IsRoot)
3193
string methodInvoke = RaCodeGen.GetStringForMethodInvoke("o", fullTypeName, $"ShouldSerialize{m.Name}", mapping.
TypeDesc
.UseReflection);
3194
if (mapping.
TypeDesc
.UseReflection) methodInvoke = $"(({typeof(bool).FullName}){methodInvoke})";
3202
string memberGet = RaCodeGen.GetStringForMember("o", $"{m.Name}Specified", mapping.
TypeDesc
);
3203
if (mapping.
TypeDesc
.UseReflection) memberGet = $"(({typeof(bool).FullName}){memberGet})";
3208
WriteMember(RaCodeGen.GetStringForMember("o", m.Name, mapping.
TypeDesc
), m.Attribute, m.TypeDesc!, "o");
3234
string methodInvoke = RaCodeGen.GetStringForMethodInvoke("o", fullTypeName, $"ShouldSerialize{m.Name}", mapping.
TypeDesc
.UseReflection);
3235
if (mapping.
TypeDesc
.UseReflection) methodInvoke = $"(({typeof(bool).FullName}){methodInvoke})";
3243
string memberGet = RaCodeGen.GetStringForMember("o", $"{m.Name}Specified", mapping.
TypeDesc
);
3244
if (mapping.
TypeDesc
.UseReflection) memberGet = $"(({typeof(bool).FullName}){memberGet})";
3254
choiceSource = RaCodeGen.GetStringForMember("o", m.ChoiceIdentifier.MemberName, mapping.
TypeDesc
);
3256
WriteMember(RaCodeGen.GetStringForMember("o", m.Name, mapping.
TypeDesc
), choiceSource, m.ElementsSortedByDerivation!, m.Text, m.ChoiceIdentifier, m.TypeDesc!, true);
3464
if (special.
TypeDesc
!.Kind == TypeKind.Attribute || special.
TypeDesc
.CanBeAttributeValue)
3477
TypeDesc typeDesc = attribute.Mapping!.
TypeDesc
!;
3509
string choiceFullName = choice.Mapping!.
TypeDesc
!.CSharpName;
3510
WriteArrayLocalDecl($"{choiceFullName}[]", "c", choiceSource, choice.Mapping.
TypeDesc
);
3515
WriteQuotedCSharpString(choice.Mapping.
TypeDesc
.FullName);
3621
string choiceFullName = choice.Mapping!.
TypeDesc
!.CSharpName;
3622
WriteLocalDecl(choiceFullName, $"{choiceName}i", RaCodeGen.GetStringForArrayMember(choiceName!, $"i{arrayName}", choice.Mapping.
TypeDesc
), choice.Mapping.
TypeDesc
.UseReflection);
3647
TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping!.
TypeDesc
!.CreateArrayTypeDesc() : elements[0].Mapping!.
TypeDesc
!;
3648
if (!elements[0].Any && !elements[0].Mapping!.
TypeDesc
!.UseReflection && !elements[0].Mapping!.
TypeDesc
!.IsOptionalValue)
3666
string? enumTypeName = choice == null ? null : choice.Mapping!.
TypeDesc
!.FullName;
3686
bool useReflection = element.Mapping!.
TypeDesc
!.UseReflection;
3687
string fullTypeName = element.Mapping.
TypeDesc
.CSharpName;
3688
bool enumUseReflection = choice.Mapping!.
TypeDesc
!.UseReflection;
3706
WriteChoiceTypeCheck(source, fullTypeName, useReflection, choice, enumFullName, element.Mapping.
TypeDesc
);
3717
bool useReflection = element.Mapping!.
TypeDesc
!.UseReflection;
3718
TypeDesc td = element.IsUnbounded ? element.Mapping.
TypeDesc
.CreateArrayTypeDesc() : element.Mapping.
TypeDesc
;
3764
bool enumUseReflection = choice.Mapping!.
TypeDesc
!.UseReflection;
3830
bool useReflection = text.Mapping!.
TypeDesc
!.UseReflection;
3831
string fullTypeName = text.Mapping.
TypeDesc
.CSharpName;
3891
WritePrimitiveValue(primitive.
TypeDesc
!, source);
3897
switch (simple.
TypeDesc
!.Kind)
3920
string fullTypeName = element.Mapping.
TypeDesc
!.BaseTypeDesc!.CSharpName;
3922
if (!element.Mapping.
TypeDesc
.BaseTypeDesc.UseReflection)
3951
Writer.Write(RaCodeGen.GetStringForTypeof(arrayMapping.
TypeDesc
!.CSharpName, arrayMapping.
TypeDesc
.UseReflection));
3963
TypeDesc td = arrayMapping.
TypeDesc
!.CreateArrayTypeDesc();
3969
WriteArrayLocalDecl(fullTypeName, elementArrayName, source, arrayMapping.
TypeDesc
);
3976
if (arrayMapping.
TypeDesc
.IsNullable)
4024
string fullTypeName = arrayMapping.
TypeDesc
!.CSharpName;
4027
WriteArrayLocalDecl(fullTypeName, arrayName, source, arrayMapping.
TypeDesc
);
4034
if (arrayMapping.
TypeDesc
.IsNullable)
4044
WriteArrayItems(arrayMapping.ElementsSortedByDerivation!, null, null, arrayMapping.
TypeDesc
, arrayName, null);
4075
if (primitiveMapping.
TypeDesc
== QnameTypeDesc)
4080
string suffixRaw = primitiveMapping.
TypeDesc
!.XmlEncodingNotRequired ? "Raw" : "";
4098
Writer.Write(RaCodeGen.GetStringForTypeof(structMapping.
TypeDesc
!.CSharpName, structMapping.
TypeDesc
.UseReflection));
4113
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, structMapping.
TypeDesc
!.Name) + Environment.StackTrace);
4127
if (structMapping.
TypeDesc
!.IsNullable)
4216
Type? type = Type.GetType(mapping.
TypeDesc
!.Type!.FullName!);
4224
Type? type = Type.GetType(mapping.
TypeDesc
!.Type!.FullName!);
4486
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, choiceMapping.
TypeDesc
!.FullName));
4489
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;