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;
1169
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, XmlSchema.Namespace);
1173
mapping.
TypeDesc
= TypeScope.GetTypeDesc(dataType, UrtTypes.Namespace);
1182
mapping.
TypeDesc
= model.TypeDesc;
1206
mapping.
TypeDesc
= model.TypeDesc;
1254
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;
682 references to TypeDesc
System.Private.Xml (682)
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 (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"));
1750
object choiceValue = Enum.Parse(choice.Mapping!.
TypeDesc
!.Type!, name);
1969
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
1973
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)
735
if (typeMapping.
TypeDesc
== typeDesc)
1152
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)
1170
if (mapping.
TypeDesc
== null)
1174
if (mapping.
TypeDesc
== null)
1184
mapping.TypeName = mapping.
TypeDesc
.DataType!.Name;
1185
mapping.Namespace = mapping.
TypeDesc
.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
1187
CheckContext(mapping.
TypeDesc
, context);
1831
if (element.Mapping.
TypeDesc
!.Kind == TypeKind.Node)
2031
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, accessor.ChoiceIdentifier.Mapping!.
TypeDesc
!.FullName));
2037
throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, accessor.ChoiceIdentifier.Mapping!.
TypeDesc
!.FullName, id, element.Name, element.Namespace));
2273
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)
2130
bool choiceUseReflection = mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection;
2131
string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.
TypeDesc
.CSharpName;
2135
_choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, $"{c}++", mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
2244
MethodNames.Add(mapping, NextMethodName(mapping.
TypeDesc
!.Name));
2390
!mapping.
TypeDesc
!.IsRoot)
2406
Writer.Write(RaCodeGen.GetStringForTypeof(mapping.
TypeDesc
.CSharpName, mapping.
TypeDesc
.UseReflection));
2796
member.TypeDesc = mapping.
TypeDesc
;
2825
if (enumMethodName == null) throw new InvalidOperationException(SR.Format(SR.XmlMissingMethodEnum, mapping.
TypeDesc
!.Name));
2830
Writer.Write(mapping.
TypeDesc
!.CSharpName);
2838
else if (mapping.
TypeDesc
== StringTypeDesc)
2842
else if (mapping.
TypeDesc
!.FormatterName == "String")
2844
if (mapping.
TypeDesc
.CollapseWhitespace)
2857
if (!mapping.
TypeDesc
.HasCustomFormatter)
2863
Writer.Write(mapping.
TypeDesc
.FormatterName);
2934
if (!mapping.
TypeDesc
!.UseReflection)
2937
Writer.Write(mapping.
TypeDesc
.CSharpName);
2974
tableName = WriteHashtable(mapping, mapping.
TypeDesc
!.Name);
2978
bool useReflection = mapping.
TypeDesc
!.UseReflection;
2979
string fullTypeName = mapping.
TypeDesc
.CSharpName;
3069
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, derived.
TypeDesc
!.Name));
3073
if (derived.
TypeDesc
!.UseReflection && isTypedReturn)
3077
if (derived.
TypeDesc
.IsNullable)
3106
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, enumMapping.
TypeDesc
!.Name));
3118
if (arrayMapping.
TypeDesc
!.HasDefaultConstructor)
3125
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
3129
TypeDesc td = arrayMapping.
TypeDesc
;
3130
string fullTypeName = arrayMapping.
TypeDesc
.CSharpName;
3141
if (arrayMapping.
TypeDesc
.IsValueType)
3162
bool useReflection = nullableMapping.BaseMapping!.
TypeDesc
!.UseReflection;
3163
string typeName = useReflection ? "object" : nullableMapping.
TypeDesc
!.CSharpName;
3196
element.IsNullable = nullableMapping.BaseMapping.
TypeDesc
.IsNullable;
3216
bool useReflection = structMapping.
TypeDesc
!.UseReflection;
3217
string typeName = useReflection ? "object" : structMapping.
TypeDesc
.CSharpName;
3223
if (structMapping.
TypeDesc
.IsNullable)
3231
if (structMapping.
TypeDesc
.IsNullable)
3235
if (structMapping.
TypeDesc
.IsRoot)
3242
if (structMapping.
TypeDesc
.IsValueType)
3244
Writer.Write(RaCodeGen.GetStringForCreateInstance(structMapping.
TypeDesc
.CSharpName, useReflection, false, false));
3254
if (!structMapping.
TypeDesc
.IsRoot)
3260
if (structMapping.
TypeDesc
.IsRoot)
3269
WriteDerivedTypes(structMapping, !useReflection && !structMapping.
TypeDesc
.IsRoot, typeName);
3270
if (structMapping.
TypeDesc
.IsRoot) WriteEnumAndArrayTypes();
3271
if (structMapping.
TypeDesc
.IsRoot)
3279
if (structMapping.
TypeDesc
.IsRoot)
3282
if (structMapping.
TypeDesc
.IsNullable)
3285
if (structMapping.
TypeDesc
.IsAbstract)
3295
if (structMapping.
TypeDesc
.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.
TypeDesc
.Type))
3316
string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.
TypeDesc
);
3317
Member member = new Member(this, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3322
member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", $"{mapping.Name}Specified", structMapping.
TypeDesc
);
3343
throw new InvalidOperationException(SR.Format(SR.XmlSequenceHierarchy, structMapping.
TypeDesc
.FullName, mapping.Name, declaringMapping!.
TypeDesc
!.FullName, "Order"));
3347
Member arrayMember = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3420
if (structMapping.
TypeDesc
!.IsRoot)
3435
if (structMapping.
TypeDesc
.IsAbstract)
3456
string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.
TypeDesc
);
3457
Member member = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.
TypeDesc
));
3459
member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", $"{mapping.Name}Specified", structMapping.
TypeDesc
);
3491
if (anyFixups) WriteFixupMethod(fixupMethodName, members, structMapping.
TypeDesc
.CSharpName, structMapping.
TypeDesc
.UseReflection, true, "o");
3798
if (special.
TypeDesc
!.Kind == TypeKind.Attribute)
3805
else if (special.
TypeDesc
.CanBeAttributeValue)
3920
WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.CSharpName}[]",
3922
member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
);
4077
WriteSourceBeginTyped(member.ArraySource, special.
TypeDesc
);
4078
switch (special.
TypeDesc
!.Kind)
4093
if (text.Mapping!.
TypeDesc
!.CollapseWhitespace)
4104
if (text.Mapping!.
TypeDesc
== StringTypeDesc || text.Mapping.
TypeDesc
!.FormatterName == "String")
4107
if (text.Mapping.
TypeDesc
!.CollapseWhitespace)
4247
TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.
TypeDesc
!;
4252
Writer.Write(RaCodeGen.GetStringForTypeof(e.Mapping!.
TypeDesc
!.CSharpName, e.Mapping.
TypeDesc
.UseReflection));
4277
if (e.Mapping!.
TypeDesc
!.IsValueType || e.Mapping is NullableMapping)
4287
TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.
TypeDesc
!;
4288
Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.
TypeDesc
.CSharpName, e.Mapping.
TypeDesc
.UseReflection, false, true, $"({td.CSharpName}){checkTypeSource}"));
4292
WriteSourceBeginTyped(member.ArraySource, e.Mapping.
TypeDesc
);
4297
if (e.Mapping.
TypeDesc
.IsValueType)
4459
bool choiceUseReflection = member.Mapping.ChoiceIdentifier.Mapping!.
TypeDesc
!.UseReflection;
4460
string choiceTypeName = member.Mapping.ChoiceIdentifier.Mapping.
TypeDesc
.CSharpName;
4534
TypeDesc td = arrayMapping.
TypeDesc
!;
4547
WriteSourceBeginTyped(source, arrayMapping.
TypeDesc
);
4551
WriteCatchCastException(arrayMapping.
TypeDesc
!, "rre", null);
4561
memberMapping.TypeDesc = arrayMapping.
TypeDesc
;
4634
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.
TypeDesc
!.Name));
4649
if (element.Mapping.
TypeDesc
!.IsValueType)
4651
Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.
TypeDesc
.CSharpName, element.Mapping.
TypeDesc
.UseReflection, false, false));
4663
if (element.Default != null && element.Default != DBNull.Value && element.Mapping.
TypeDesc
!.IsValueType)
4678
if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan) || element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset))
4684
if (element.Mapping.
TypeDesc
!.Type == typeof(TimeSpan))
4688
else if (element.Mapping.
TypeDesc
!.Type == typeof(DateTimeOffset))
4708
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
4713
switch (element.Mapping.
TypeDesc
.FormatterName)
4754
if (mapping.
TypeDesc
!.IsValueType)
4762
WriteSourceBeginTyped(source, mapping.
TypeDesc
);
4766
WriteCatchCastException(mapping.
TypeDesc
, "rre", null);
4770
if (mapping.
TypeDesc
.IsValueType)
4781
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name));
4793
if (mapping.
TypeDesc
!.IsNullable)
4806
switch (special.
TypeDesc
!.Kind)
4809
bool isDoc = special.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
4810
WriteSourceBeginTyped(source, special.
TypeDesc
);
4831
WriteSourceBeginTyped(source, sm.
TypeDesc
);
4835
if (sm.
TypeDesc
!.CSharpName == "global::System.Xml.Linq.XElement")
4837
Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.
TypeDesc
!.CSharpName, false, false, false, "\"default\""));
4841
Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.
TypeDesc
!.CSharpName, sm.
TypeDesc
.UseReflection, sm.
TypeDesc
.CannotNew, false));
4874
string enumTypeName = choice.Mapping!.
TypeDesc
!.CSharpName;
4878
Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.
TypeDesc
.UseReflection));
4900
WriteSourceBeginTyped(source, head.
TypeDesc
);
4904
Writer.Write(RaCodeGen.GetStringForCreateInstance(derived.
TypeDesc
!.CSharpName, derived.
TypeDesc
.UseReflection, derived.
TypeDesc
.CannotNew, false));
5052
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
5053
bool useReflection = mapping.
TypeDesc
.UseReflection;
5054
bool ctorInaccessible = mapping.
TypeDesc
.CannotNew;
5068
Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.
TypeDesc
.CannotNew, true));
System\Xml\Serialization\XmlSerializationReaderILGen.cs (115)
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))
3075
LocalBuilder tmpLoc = ilg.GetTempLocal(element.Mapping.
TypeDesc
!.Type);
3077
ilg.InitObj(element.Mapping.
TypeDesc
!.Type);
3079
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type);
3083
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type);
3089
if (element.Mapping.
TypeDesc
== QnameTypeDesc)
3102
switch (element.Mapping.
TypeDesc
.FormatterName)
3115
WriteSourceEnd(source, element.Mapping.
TypeDesc
.Type!);
3127
if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, mapping.
TypeDesc
!.Name));
3153
if (mapping.
TypeDesc
!.IsNullable)
3163
mapping.
TypeDesc
.Type,
3167
WriteSourceEnd(source, mapping.
TypeDesc
.Type!);
3174
switch (special.
TypeDesc
!.Kind)
3177
bool isDoc = special.
TypeDesc
.FullName == typeof(XmlDocument).FullName;
3188
if (special.
TypeDesc
!= null)
3189
ilg.Castclass(special.
TypeDesc
.Type!);
3190
WriteSourceEnd(source, special.
TypeDesc
!.Type!);
3228
ReflectionAwareILGen.ILGenForCreateInstance(ilg, sm.
TypeDesc
!.Type!, sm.
TypeDesc
.CannotNew, false);
3229
if (sm.
TypeDesc
.CannotNew)
3235
if (sm.
TypeDesc
!= null)
3236
ilg.ConvertValue(typeof(IXmlSerializable), sm.
TypeDesc
.Type!);
3237
WriteSourceEnd(source, sm.
TypeDesc
!.Type!);
3261
ReflectionAwareILGen.ILGenForEnumMember(ilg, choice.Mapping!.
TypeDesc
!.Type!, choice.MemberIds[elementIndex]);
3262
WriteSourceEnd(choiceSource!, choice.Mapping.
TypeDesc
.Type!);
3299
ReflectionAwareILGen.ILGenForCreateInstance(ilg, derived.
TypeDesc
!.Type!, derived.
TypeDesc
.CannotNew, false);
3300
if (derived.
TypeDesc
.CannotNew)
3306
if (head.
TypeDesc
!= null)
3307
ilg.ConvertValue(typeof(IXmlSerializable), head.
TypeDesc
.Type!);
3308
WriteSourceEnd(source, head.
TypeDesc
!.Type!);
3429
string fullTypeName = mapping.
TypeDesc
!.CSharpName;
3430
bool ctorInaccessible = mapping.
TypeDesc
.CannotNew;
3433
mapping.
TypeDesc
.Type!,
3440
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;