99 throw Globals.
NotSupported(
"XmlQualifiedName DefaultValue not supported. Fail in WriteValue()");
116 throw Globals.
NotSupported(
"XmlQualifiedName DefaultValue not supported. Fail in WriteValue()");
139 else if (!
typeDesc.HasCustomFormatter)
158 if (
typeDesc.FormatterName ==
"XmlQualifiedName")
184 for (
int i = 0; i <
array.Length; i++)
306 WriteTag(
"WriteNullTagLiteral", name, ns);
312 WriteTag(
"WriteEmptyTag", name, ns);
450 choiceSource =
$"(({membersMapping.Members[m].TypeDesc.CSharpName})p[{m}])";
455 WriteMember(
new SourceInfo(
text4,
text4,
null,
null,
ilg),
choiceSource,
memberMapping2.ElementsSortedByDerivation,
memberMapping2.Text,
memberMapping2.ChoiceIdentifier,
memberMapping2.TypeDesc,
writeAccessors ||
hasWrapperElement);
492 if (!
mapping.TypeDesc.IsValueType && !
mapping.TypeDesc.Type.IsPrimitive)
498 WriteMember(
new SourceInfo(
"o",
"o",
null,
typeof(
object),
ilg),
null,
new ElementAccessor[1] {
accessor },
null,
null,
mapping.TypeDesc,
writeAccessors:
true);
554 base.RaCodeGen.ILGenForEnumLongValue(
ilg,
"v");
744 WriteMember(
new SourceInfo(
"o",
"o",
null,
null,
ilg),
null,
arrayMapping.ElementsSortedByDerivation,
null,
null,
arrayMapping.TypeDesc,
writeAccessors:
true);
769 if (
mapping.TypeDesc.IsNullable)
777 if (
mapping.TypeDesc.IsNullable)
838 if (!
mapping.TypeDesc.IsAbstract)
877 typeof(XmlSerializerNamespaces)
946 WriteMember(
base.RaCodeGen.GetSourceForMember(
"o",
memberMapping3,
memberMapping3.MemberInfo,
mapping.TypeDesc,
ilg),
choiceSource,
memberMapping3.ElementsSortedByDerivation,
memberMapping3.Text,
memberMapping3.ChoiceIdentifier,
memberMapping3.TypeDesc,
writeAccessors:
true);
1045 name =
"WriteValue";
1084 throw Globals.
NotSupported(
"Also fail in whidbey IEnumerable member with XmlAttributeAttribute");
1193 if (elements.Length != 0 ||
text !=
null)
1206 string text3 =
null;
1285 WriteElements(
new SourceInfo(
text2,
null,
null,
arrayElementTypeDesc.Type,
ilg),
choiceName +
"i", elements,
text,
choice,
arrayName2,
writeAccessors:
true,
isNullable:
true);
1308 WriteElements(
new SourceInfo(
text4,
null,
null,
arrayElementTypeDesc.Type,
ilg),
choiceName +
"i", elements,
text,
choice,
arrayName3,
writeAccessors:
true,
arrayElementTypeDesc.IsNullable);
1312 WriteElements(
new SourceInfo(
base.RaCodeGen.GetStringForArrayMember(
arrayName,
text3,
arrayTypeDesc),
null,
null,
arrayElementTypeDesc.Type,
ilg),
null, elements,
text,
choice,
arrayName3,
writeAccessors:
true,
arrayElementTypeDesc.IsNullable);
1320 if (elements.Length == 0 &&
text ==
null)
1324 if (elements.Length == 1 &&
text ==
null)
1327 if (!elements[0].
Any && !elements[0].
Mapping.TypeDesc.IsOptionalValue)
1414 if (
flag2 && num > 0 && elements.Length - num <= 0)
1420 if (elements.Length - num > 0)
1447 string value =
null;
1559 if (elements.Length != 0)
1573 if (elements.Length != 0)
1837 else if (
value.GetType().IsPrimitive)
1873 ilg.MarkLabel(
label);
1884 ilg.Ldstr(GetCSharpString(
typeDesc.FullName));
1885 ilg.Ldstr(GetCSharpString(
choice.MemberName));
1886 ilg.Ldstr(GetCSharpString(
enumName));
1898 ilg.If(
Cmp.EqualTo);
1914 for (
int i = 0; i <
members.Length; i++)
1959 if (element.
Any && element.
Name.Length == 0)
1969 int num =
xmlName.LastIndexOf(
':');
1979 if (
text ==
null ||
text.Length == 0)
1981 if (element.
Any && element.
Name.Length == 0)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static ? object ChangeType(object? value, TypeCode typeCode)
static readonly DBNull Value
static object Parse(Type enumType, string value)
static object ToObject(Type enumType, object value)
static CultureInfo InvariantCulture
ConstructorBuilder DefineDefaultConstructor(MethodAttributes attributes)
TypeInfo? CreateTypeInfo()
static string XmlInternalError
static string XmlChoiceMissingAnyValue
static string Format(string resourceFormat, object p1)
static string XmlChoiceMissingValue
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
virtual Type MakeGenericType(params Type[] typeArguments)
static readonly Type[] EmptyTypes
MethodInfo? GetMethod(string name)
void MarkLabel(Label label)
void Brfalse(Label label)
void Stelem(Type arrayElementType)
void ConvertAddress(Type source, Type target)
void ConvertValue(Type source, Type target)
MethodBuilder EndMethod()
LocalBuilder DeclareLocal(Type type, string name)
LocalBuilder DeclareOrGetLocal(Type type, string name)
void WhileBeginCondition()
void New(ConstructorInfo constructorInfo)
void LdargAddress(ArgBuilder argBuilder)
void BeginMethod(Type returnType, string methodName, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes)
void LoadAddress(object obj)
static TypeBuilder CreateTypeBuilder(ModuleBuilder moduleBuilder, string name, TypeAttributes attributes, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type parent, Type[] interfaces)
object GetVariable(string name)
Type GetVariableType(object var)
ArgBuilder GetArg(string name)
void Call(MethodInfo methodInfo)
void NewArray(Type elementType, object len)
void Stloc(Type type, string name)
void Ldstr(string strVar)
object For(LocalBuilder local, object start, object end)
LocalBuilder GetLocal(string name)
void LdlocAddress(LocalBuilder localBuilder)
void Ldloc(LocalBuilder localBuilder)
static void CheckValidIdentifier([NotNull] string ident)
static string MakeValidInternal(string identifier)
static Exception NotSupported(string msg)
TypeDesc CreateArrayTypeDesc()
static MemberMapping[] GetAllMembers(StructMapping mapping)
void ILGenLoad(string source)
string ReferenceMapping(TypeMapping mapping)
MethodBuilder EnsureMethodBuilder(TypeBuilder typeBuilder, string methodName, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
Dictionary< string, MemberInfo > memberInfos
MethodBuilderInfo GetMethodBuilder(string methodName)
string GetCSharpString(string value)
void GenerateReferencedMethods()
static object GetConvertedDefaultValue([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type targetType, object rawDefaultValue)
void WriteText(SourceInfo source, TextAccessor text)
void WriteArrayItems(ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc arrayTypeDesc, string arrayName, string choiceName)
void WriteElements(SourceInfo source, string enumSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, string arrayName, bool writeAccessors, bool isNullable)
string FindChoiceEnumValue(ElementAccessor element, EnumMapping choiceMapping, out object eValue)
XmlSerializationWriterILGen(TypeScope[] scopes, string access, string className)
void WriteQualifiedNameElement(string name, string ns, object defaultValue, SourceInfo source, bool nullable, TypeMapping mapping)
void WriteNamespaces(string source)
void WriteAttribute(SourceInfo source, AttributeAccessor attribute, string parent)
void WriteEndElement(string source)
string NextMethodName(string name)
void WriteCheckDefault(SourceInfo source, object value, bool isNullable)
bool CanOptimizeWriteListSequence(TypeDesc listElementTypeDesc)
void WriteArrayLocalDecl(string typeName, string variableName, SourceInfo initValue, TypeDesc arrayTypeDesc)
void WriteLiteralNullTag(string name, string ns)
void WriteMember(SourceInfo source, AttributeAccessor attribute, TypeDesc memberTypeDesc, string parent)
void WriteEmptyTag(string name, string ns)
void WriteEnumAndArrayTypes()
void WriteNullCheckBegin(string source, ElementAccessor element)
void WriteTag(string methodName, string name, string ns)
void WriteChoiceTypeCheck(SourceInfo source, string fullTypeName, ChoiceIdentifierAccessor choice, string enumName, TypeDesc typeDesc)
void WriteEnumMethod(EnumMapping mapping)
void WriteTypeCompare(string variable, Type type)
string GenerateMembersElement(XmlMembersMapping xmlMembersMapping)
void WriteMember(SourceInfo source, string choiceSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc memberTypeDesc, bool writeAccessors)
void WriteArray(SourceInfo source, string choiceSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc arrayTypeDesc)
void WriteArrayTypeCompare(string variable, Type arrayType)
void WriteEnumValue(EnumMapping mapping, SourceInfo source, out Type returnType)
void GenerateInitCallbacksMethod()
int FindXmlnsIndex(MemberMapping[] members)
void WritePrimitive(string method, string name, string ns, object defaultValue, SourceInfo source, TypeMapping mapping, bool writeXsiType, bool isElement, bool isNullable)
void WriteElementCall(string func, Type cast, SourceInfo source, string name, string ns, bool isNullable, bool isAny)
void WriteStructMethod(StructMapping mapping)
string GenerateTypeElement(XmlTypeMapping xmlTypeMapping)
string GenerateElement(XmlMapping xmlMapping)
void WritePrimitiveValue(TypeDesc typeDesc, SourceInfo source, out Type returnType)
override void GenerateMethod(TypeMapping mapping)
void WriteStartElement(string name, string ns, bool writePrefixed)
void WriteLocalDecl(string variableName, string initValue, Type type)
void WriteInstanceOf(SourceInfo source, Type type)
void WriteDerivedTypes(StructMapping mapping)
void WriteTag(string methodName, string name, string ns, bool writePrefixed)
void WriteElement(SourceInfo source, ElementAccessor element, string arrayName, bool writeAccessor)
DynamicallyAccessedMemberTypes
void AppendLiteral(string value)
void AppendFormatted(ReadOnlySpan< char > value)