Before the change when the property default value was not null or empty the deserialized value would be the concatenation of the default value and the serialized value.
The correct behavior is to use the serialized value only.
Fixes 18908.
SerializationCodeGenerator and XmlSerializationWriterInterpreter will no longer serialize an attribute named {V} if its object has a method named ShouldSerialize{V}() that returns false.
{V}Specified now is also checked to be true before serializating the attribute even if it is a property that is not settable.
Fixes#1852.
Non-nullable web service parameters can be made optional by
adding an additional parameter with the same name and a
'Specified' suffix. This was supported when serializing
classes, but not when serializing web service parameters.
This might fix bug 688496.
Issues include: casts not being properly generated for nullable
types, missing cast when the type of a member does not match
the forced serialization type, and incorrect code generated
for handling [XmlText] members.
* XmlReflectionImporter.cs, SerializationCodeGenerator.cs,
XmlSerializationWriterInterpreter.cs: XmlAnyElementAttribute can be
still used for non-XmlNode (object) array. It only fails when it
tries to serialize non-XmlNode object at run-time.
Fixed bug #553032.
* XmlSerializerTests.cs : added test for bug #553032.
svn path=/trunk/mcs/; revision=150197
* SerializationCodeGenerator.cs : enum value identifiers should be
escaped with '@'. Fixed bug #566370.
* XmlSerializerTests.cs : added test for #566370.
svn path=/trunk/mcs/; revision=149104
* SerializationCodeGenerator.cs
XmlSerializationWriterInterpreter.cs : fixed bug #419973.
Sometimes implicit operators could involve and it affects on
typecasting. It's simple for code generator, but very bad for
reflection.
* XmlSerializerTestClasses.cs, XmlSerializerTests.cs:
added test for bug #419973.
svn path=/trunk/mcs/; revision=112103
* XmlSerializationReaderInterpreter.cs, MapCodeGenerator.cs,
SerializationCodeGenerator.cs : fixed bug #378696.
Default value should not be filled during deserialization, and
default values for DateTime/TimeSpan/DateTimeOffset should not be
output as raw string in generated code.
* XmlSerializerTestClasses.cs, DeserializeTests.cs,
ComplexDataStructure.cs : added test for bug #378696.
Fixed couple of wrong tests that expects default values filled
during deserialization.
svn path=/trunk/mcs/; revision=104983
* XmlSerializationReaderInterpreter.cs,
XmlSerializationWriterInterpreter.cs: Properly handle nullable enum
values.
* SerializationCodeGenerator.cs: Properly handle nullable enum values.
Don't generate read flags for text collectors (avoid var not used
warning).
* XmlReflectionImporter.cs: Assign the MappedType to text collector
members. It is needed when the member is an enum.
svn path=/trunk/mcs/; revision=99512
* XmlSerializerTests.cs : added deserialization test for
XmlSchemaProviderAttribute use.
* XmlReflectionImporterTests.cs : added test for conclict resolution
between defaultNamespace and XmlSchemaProvider() namespace.
* XmlSchemaExporterTests.cs : use Infoset() comparison.
* XmlTypeMapping.cs : Namespace and XmlTypeNamespace could be
different when an explicit namespace is specified (e.g. at
XmlReflectionImporter.ctor).
* SerializationCodeGenerator.cs,
XmlSerializationWriterInterpreter.cs :
revert XmlTypeMapping.XmlTypeNamsepace usage. Now with the fix
above, original code should work fine.
svn path=/trunk/mcs/; revision=86346
* XmlTypeMapping.cs, XmlSerializationWriterInterpreter.cs,
SerializationCodeGenerator.cs :
More XmlSchemaProviderAttribute method check. Use QName returned
by the method for the output root name.
* XmlSerializerTests.cs, XmlReflectionImporterTests.cs :
added tests for XmlSchemaProviderAttribute and how its qname works.
svn path=/trunk/mcs/; revision=86340
* XmlCustomFormatter.cs : ditto for reader method generation.
* SerializationCodeGenerator.cs : for generic nullable values it
needs to store ReadNullableString() result to a temporary variable.
* XmlSerializerTests.cs : another case on #80759 from gert.
svn path=/trunk/mcs/; revision=76160
* SerializationCodeGenerator.cs : fix wrong name comparison:
Name->LocalName. Add hacky TARGET_JVM support (hope it is harmless).
svn path=/trunk/mcs/; revision=73527
* SerializationCodeGenerator.cs,
XmlSerializationReaderInterpreter.cs :
Handle attributes on non-empty elements as well. Fixed bug #80131.
* XmlSerializationReaderTests.cs : test non-empty element as well.
svn path=/trunk/mcs/; revision=73145
* SerializationCodeGenerator.cs,
XmlSerializationReaderInterpreter.cs :
Handle empty root element.
Read out attribute parameters. To do that, split attribute
reader part from ReadMembers(), as it isn't invoked when the
element is empty.
* XmlSerializationReaderTests.cs : added test for out attribute
parameters. It also tests empty root element.
svn path=/trunk/mcs/; revision=73143
* SerializationCodeGenerator.cs : hooks won't work unless they are
set. For WriteStartElement() it could simply embed the names.
svn path=/trunk/mcs/; revision=73112
* XmlSerializationWriter.cs : WriteTypedPrimitive() does not support
XmlNode arrays.
* XmlSerializationWriterInterpreter.cs,
SerializationCodeGenerator.cs : so they have to be handled here.
* XmlSerializerTests.cs : added some XmlNode array/list tests.
* XmlSerializationWriterTests.cs : removed more NotWorking. Added
WriteTypedPrimitive() error test for XmlNode.
svn path=/trunk/mcs/; revision=72448
* SerializationCodeGenerator.cs, XmlCustomFormatter.cs :
GenerateToXmlString() needed hexBinary support as well. Since
XmlConvert.[To|From]BinHexString() are internal, use reflection.
Really fixed bug #79989 and #79990 for generated serializers.
* XmlSerializerTests.cs :
added base64 tests which is similar to hexBinary.
svn path=/trunk/mcs/; revision=68927
* XmlSerializerTests.cs : test for basic generic type support with
code generation.
* SerializationCodeGenerator.cs, TypeData.cs :
Now we differentiate TypeName, FullTypeName C# type names. It is
to create valid C# sources especially for generic types.
Fixed bug #79657.
svn path=/trunk/mcs/; revision=68058
* SerializationCodeGenerator.cs,
SerializationCodeGeneratorConfiguration.cs :
make "XmlSerializerContract" and "BaseXmlSerializer" customizible.
(or it is impossible to use genxs more than twice in an assembly.)
* XmlSerializerImplementationTests.cs :
another custom implementation case.
svn path=/trunk/mcs/; revision=67857
* XmlSerializerTestClasses.cs: Added test classes for encoded SOAP.
* XmlSerializerTests.cs: Added new tests and fixed existing test.
* XmlReflectionImporterTests.cs: Added test for invalid default
values.
* SoapReflectionImporterTests.cs: Fixed numbering of tests.
* XmlSerializer.cs: Corrected exception message when deserialization
fails.
* SerializationCodeGenerator.cs: Added support for flag enums.
* XmlReflectionImporter.cs: Use InvalidOperationException wrapper for
all exceptions that occur while reflecting member. Validate default
values to match MS.
* SoapReflectionImporter.cs: Revert small part of previous patch as
XmlSerializer expects enum value.
svn path=/trunk/mcs/; revision=66524
* XmlTypeMapMember.cs: Added GlobalIndex property.
* XmlTypeMapping.cs: When adding a member, initialize its GlobalIndex
property.
* SerializationCodeGenerator.cs:
* XmlSerializationWriterInterpreter.cs:
* XmlSerializationReaderInterpreter.cs: Use GlobalIndex instead of
Index to get/set the values from the input array, since some Index
values are shared between attribute and element members. Fixes
bug #78562.
svn path=/trunk/mcs/; revision=61531
bug #78204.
* SerializationCodeGenerator.cs: For flag enums, we should split on all
whitespace chars instead of only on blanks.
* XmlTypeMapping.cs: Same. Added ToEnum method for converting from
constant name(s) to integral enum value.
svn path=/trunk/mcs/; revision=59918
* XmlSerializerTests.cs: Enabled tests for bug #77530.
* XmlTypeMapping.cs: EnumMapMember now also stores value for enums.
Modified EnumMapping.GetXmlName to use XmlCustomFormatter to support
serialization of integral value to enum constant name, and made sure
the exceptions we throw match those of MSFT. In EnumMapping.GetEnumName
throw InvalidOperationException if no matching enum constant exists.
In EnumMap ctor, initialize arrays holding XML names, enum names and
enum values.
* XmlSerializationReaderInterpreter.cs: Pass full type name to
EnumMapping.GetEnumName for construction of exception message.
* XmlSerializer.cs: In Deserialize, wrap InvalidOperationException
and InvalidCastException in another InvalidOperationException to match
MSFT. In Serialize, wrap InvalidOperationException, InvalidCastException
and the inner exception for a TargetInvocationException in an
InvalidOperationException to match MSFT.
* SerializationCodeGenerator.cs: In GenerateGetXmlEnumValue, use
XmlCustomFormatter.FromEnum in order to also support serialization
integral value to enum constant name. In 2.0 profile, throw
InvalidOperationException if numeric value cannot be serialized into
an enum constant value. In GenerateSingleEnumValue, no longer attempt
to parse unknown constant value but instead report it as
InvalidOperationException. Use string.Length instead of "" comparison
to check whether a string is empty. Fixed compiler warnings in
generated code (possible empty statement).
* XmlSerializationWriterInterpreter.cs: Pass full type name to
EnumMap.GetXmlName.
* XmlSchemaImporter.cs: Pass full type name to EnumMap.GetEnumName
to allow it to be used in exception messag* XmlReflectionImporter.cs.
Use FieldInfo instead of MemberInfo for enum fields. Use IsDefined
instead of GetCustomAttributes for checking if a certain attribute
is defined. Use integral value of enum constant in EnumMapMember ctor.
* SoapReflectionImporter.cs: Use FieldInfo instead of MemberInfo for
enum fields. Use IsDefined instead of GetCustomAttributes for checking
if a certain attribute is defined. Use integral value of enum constant
in EnumMapMember ctor.
es.
svn path=/trunk/mcs/; revision=57761
* XmlSerializationReaderInterpreter.cs: When deserializing a "flat"
collection, don't create a new collection if the property already has a
collection instance.
* SerializationCodeGenerator.cs: same as above. Also return an empty
string for flag enum default values.
svn path=/trunk/mcs/; revision=54043
* XmlSerializerTestClasses.cs:
* DeserializeTests.cs: Added tests for bug #76808 and related behavior.
2005-12-05 Lluis Sanchez Gual <[email protected]>
* XmlSerializationReaderInterpreter.cs:
* SerializationCodeGenerator.cs: When deserializing a collection,
don't create a new collection if the property already has a
collection instance. This does not apply to arrays. Changed how nullabe
array properties are set. Setting IsNullable=false to the property means
that it won't be set if the read array is null (so, if the property
already has a value, it will be kept).
Another change is that can't never be null (only arrays can).
svn path=/trunk/mcs/; revision=53949
* SerializationCodeGenerator.cs:
* XmlSerializationWriterInterpreter.cs: Arrays of XmlNode don't
need to be all XmlElments. Fix by Atsushi for bug #76288.
svn path=/trunk/mcs/; revision=51795
* XmlTypeMapping.cs: Added ChoiceMember to ListMap.
In ListMap.FindElement, take into account the ChoiceMember
if set.
* SerializationCodeGenerator.cs:
* XmlSerializationReaderInterpreter.cs: For lists with a choice
member, fill the member with the corresponding enum values.
* XmlReflectionImporter.cs: Properly reflect the choice member
when applied to a list.
* XmlSerializationWriterInterpreter.cs: Track class changes.
* XmlTypeMapMemberElement.cs: Added ChoiceTypeData property.
All this fixes bug #76203.
svn path=/trunk/mcs/; revision=50779
* XmlTypeMapping.cs: Added ListMembers property that returns
members which are collections.
* SerializationCodeGenerator.cs:
* XmlSerializationReaderInterpreter.cs: Initialize collection
members to an empty collection by default. Fixes bug #75662.
svn path=/trunk/mcs/; revision=48037
* SerializationCodeGenerator.cs: In the generated serializer always
use the Object equality operator when comparing objects to serialize
to null, since those objects may have the equality operator
overloaded. This fixes bug #75543.
svn path=/trunk/mcs/; revision=47296
* SerializationCodeGenerator.cs: When reading members by order,
call a MoveToContext after each member read. In the fixup method
don't cast returned values if it is reading an object array.
* XmlSchemaImporter.cs: In ImportDerivedTypeMapping, if the type
being imported is a primitive type, create a wrapper class that
inherits from the provided one. This fixes bug #68809.
* XmlSerializationReader.cs: Properly report unreferenced objects.
Created an overload of ReadTypedPrimitive that reports elements of
unknown type. Implemented Referenced().
svn path=/trunk/mcs/; revision=45586
* XmlTypeMapping.cs: Added new XmlSerializableMapping class.
* XmlSchemaExporter.cs: When exporting an IXmlSerializable type,
export the schema that it defines. In ImportNamespace, removed
check for default namespace, since it may be included from a non
default namespace.
* XmlReflectionImporter.cs: Create a special map for IXmlSerializable
types. All this based on a patch by Andrew Skiba.
* SerializationCodeGenerator.cs:
* XmlMapping.cs:
* XmlSerializationReaderInterpreter.cs:
* SoapCodeExporter.cs:
* XmlTypeMapMemberAttribute.cs:
* XmlSerializationReader.cs:
* XmlCodeExporter.cs: Fixed some warnings.
2005-04-10 Andrew Skiba <[email protected]>
2005-04-03 Andrew Skiba <[email protected]>
svn path=/trunk/mcs/; revision=42841