NET_2_1 is also defined whenever we define MOBILE, so they have the same effect. Silverlight was 2.1 but it's been dead for a while now, and we do not even support it.
When reflecting a class which inherits serializable members from a
base class, the members of the base class must be serialized using the
namespace set in the subclass unless a namespace has been explicitly
set in the base class. Before the fix, the members were always
serialized using the namespace of the base class, even when not set
(in which case it was using the default empty namespace).
Fixes bug 8468 - XML serialization problem.
The IsNullable attribute in XmlElementAttribute is false by default,
so when not using it in a member which was already nullable
(i.e. Nullable<DateTime>), Mono was overriding the attribute causing
a FormatException later if an xsi:nil value was found when deserializing.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=7613
* XmlAnyElementAttributes.cs:
* XmlArrayItemAttributes.cs:
* XmlElementAttributes.cs:
Under Silverlight API this implement IList only (does not
inherit from CollectionBase).
* XmlCustomFormatter.cs:
* XmlSerializationWriterInterpreter.cs:
Use a Convert.ChangeType override that exists in SL API
* XmlReflectionImporter.cs: Provide an alternative for (missing in SL)
Enum.GetNames and select available (in SL) overloads for parsing and
formatting for enums
* XmlSerializationReader.cs: Fix ToEnum API to use IDictionary (in SL)
instead of Hashtable (even if the SL4 docs still states the later)
* XmlSerializationReaderInterpreter.cs:
* XmlTypeMapping.cs:
Use the default (identical to nonPublic being false) when using
Activator.CreateInstance under SL
* XmlSerializationWriter.cs: Internally use a Queue<T> instead a a Queue
(not available in SL). Also Namespaces (ArrayList) is replaced by
XmlNamespaces (IList) in SL API.
* XmlSerializer.cs: Do not use environment variables in MOONLIGHT (like
the rest of MOBILE). Use Encoding.UTF8 instead of ENcoding.Default since
the later does not exist in SL.
* XmlSerializerImplementation.cs: SL version use IDictionary instead of
Hashtable for properties.
* XmlSerializerNamespaces.cs: Internally use a generic Dictionary
* instead
of a ListDictionary (which is not available in SL)
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.
* 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
* 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
* XmlReflectionImporter.cs : set key for imported type mapping so
that generated serializer does not result in duplicate key error.
Fixed bug #372780.
svn path=/trunk/mcs/; revision=98729
* XmlReflectionImporter.cs : do not reject XmlArrayAttribute on
byte[] (processed as primitive SchemaType). Fixed bug #81880.
* XmlReflectionImporterTest.cs : test for bug #81880.
svn path=/trunk/mcs/; revision=84548
* XmlReflectionImporter.cs : CanBeNull() should return true when the
argument is generic nullable value type.
* XmlReflectionImporterTests.cs : added test for nullable int import.
svn path=/trunk/mcs/; revision=73117
* XmlSchemaExporter.cs: Emit xml name of enum-based default values.
Set XmlSchemaAttribute.Use to Required if no default value is defined,
and member is not an optional value type. Element should have minOccurs
1 if value type member has default value. Output flag enum type as
xsd list with restriction.
* XmlReflectionImporter.cs: Removed special casing of enums. Instead
of passing namespace of XmlAttribute to ImportTypeMapping, use the
default namespace for importing the member type.
svn path=/trunk/mcs/; revision=68887
* XmlReflectionImporter.cs : implemented several missing check and
support for XmlArrayAttribute. Fixed bug #78042.
* XmlSerializerTests.cs : added tests for XmlArrayAttribute support.
svn path=/trunk/mcs/; revision=68792
Fixed bug #78611.
* TypeData.cs, TypeTranslator.cs: improved TypeData to actually store
"nullable" information. Introduced new primitiveNullableTypes pool
whose TypeData has 'true' for new IsNullable property. This
property is also used for non-primitive types.
* XmlReflectionImporter.cs : there, use TypeData.IsNullable instead
of IsValueType, to handle nullable types.
* XmlReflectionImporterTests.cs : added test for class that contains
nullable value type field whose XmlElementAttribute IsNullable.
svn path=/trunk/mcs/; revision=68341
Fixed bug #77117.
* XmlReflectionImporter.cs : Compute nullable correctly. Elements are
nillable when its type is a reference type.
* XmlSchemaExporter.cs :
Set XmlTypeMapElementInfo.IsNullable from XmlTypeMapping.
Set XmlSchemaElement.IsNillable from XmlTypeMapElementInfo.
* XmlSchemaExporterTests.cs :
fixed almost all test cases which expected totally wrong schemas.
Schema elements are all nillable unless it is of value type.
svn path=/trunk/mcs/; revision=67662
* CodeIdentifier.cs : in 2.0 profile, .ctor() is exposed to
explicitly say Obsolete instantiation.
* CodeIdentifiers.cs : implemented case-insensitive mode.
* XmlSerializerAssemblyAttribute.cs : added missing .ctor().
* SoapIncludeAttribute.cs, XmlIncludeAttribute.cs :
in 2.0 profile it could also be applied to an interface.
* SoapReflectionImporter.cs,
XmlReflectionImporter.cs,
XmlMappingAccess.cs :
added missing ImportMembersMapping overload and moved actual
implementation to most lengthy-arglist one. To make it possible,
XmlMappingAccess is included in 1.x as internal enum.
svn path=/branches/atsushi/mcs/; revision=67256
* 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
* XmlSchemaImporterTests.cs: Fixed EnumSimpleContent test to pass
on MS.NET 2.0.
* XmlCodeExporter.cs: On 2.0 profile, CodeGenerationOptions defaults to
GenerateProperties. Use full type name for XML serialization attributes
instead of shortcut (without Attribute suffix). Always add Namespace
argument for XmlRootAttribute on classes. Added IsNullable argument for
XmlRootRootAttribute on classes. For attribute members, only output
Form argument for XmlSchemaForm.Qualified. Use MapCodeGenerator base
ctor that takes CodeGenerationOptions.
* SoapCodeExporter.cs: Use MapCodeGenerator base ctor that takes
CodeGenerationOptions.
* MapCodeGenerator.cs: Added CodeGenerationOptions to ctor. On 2.0
profile, emit GeneratedCodeAttribute, SerializableAttribute,
DebuggerStepThroughAttribute and DesignerCategoryAttribute for classes.
To match MS.NET, emit attribute members before element members.
* XmlReflectionImporter.cs: Enums are never nullable.
* XmlSchemaImporter.cs: Set IsNullable on map using value of
XmlSchemaElement.IsNillable. Added LocateElement overload that takes
XmlSchemaElement.
svn path=/trunk/mcs/; revision=59768
* XmlSchemaImporter.cs: Make sure we pass TypeData for primitive types
to XmlReflectionImporter and SoapReflectionImporter to keep from
always ending up with the XSD type that directly maps to the CLR type.
* XmlReflectionImporter.cs: Added overloads taking TypeData instead of
Type. This improves performance by avoiding the use of
TypeTranslator.GetTypeData for types imported from a schema and fixes
bug #77907.
* SoapReflectionImporter.cs: Same.
svn path=/trunk/mcs/; revision=59508
void and null type argument. Improved WrongChoices test to make sure
the exception(s) we throw match those of MSFT. Added test for bug
#77591.
* XmlReflectionImporter.cs: Throw NotSupportException instead of
InvalidOperationException (IOE) if void is specified as type in
ImportTypeMapping. To match MS.NET, surround importing of type in
try/catch block, and wrap any IOE in another IOE adding information
on the type that was being reflected. In CreateTypeMapping, surround
creating of map member in try/catch block, and wrap any IOE in another
IOE adding information on the member that was being reflected.
Modified exception message for missing enumeration value to match
MS.NET. In ImportTextElementInfo, throw IOE if Type is set in
XmlTextAttribute, and it differs from type of reflected member when
schema type of member is primitive or enum. Fixed bug #77591.
svn path=/trunk/mcs/; revision=58314
* XmlSchemaExporter.cs: Import namespace of schema generated for
non-xsd primitive. Do not set zero-length TargetNamespace to avoid
emitting empty targetNamespace attribute in generated schema.
* XmlReflectionImporter.cs: Use WSDL types namespace for non-xsd
primitives.
svn path=/trunk/mcs/; revision=58132
* 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
* XmlReflectionImporter.cs: Ignore the element namespace if
the schema form is set to Unqualified. Fixes bug #75019.
svn path=/trunk/mcs/; revision=57688
* 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
* SerializationSource.cs: Fix nullref.
* XmlReflectionImporter.cs: When registering a type using
IncludeType(), make sure it is added as a subtype and the
map for typeof(object) if it has already been imported.
Fixes bug #76049.
svn path=/trunk/mcs/; revision=50379
of XmlArrayItemAttribute.IsNullable.
* SoapAttributeAttributeTests.cs: Added tests for default values.
* SoapElementAttributeTests.cs: Added tests for default values.
* SoapEnumAttributeTests.cs: Added tests for default values.
* SoapIncludeAttributeTests.cs: Added tests for default values.
* SoapSchemaMemberTests.cs: Added tests for default values.
* SoapTypeAttributeTests.cs: Added tests for default values.
* XmlAnyElementAttributeTests.cs: Added tests for default values.
* XmlArrayAttributeTests.cs: Added tests for default values.
* XmlArrayItemAttributeTests.cs: Added tests for default values.
* XmlAttributeAttributeTests.cs: Added tests for default values.
* XmlChoiceIdentifierAttributeTests.cs: Added tests for default values.
* XmlElementAttributeTests.cs: Added tests for default values.
* XmlEnumAttributeTests.cs: Added tests for default values.
* XmlIncludeAttributeTests.cs: Added tests for default values.
* XmlRootAttributeTests.cs: Added tests for default values.
* XmlTextAttributeTests.cs: Added tests for default values.
* XmlTypeAttributeTests.cs: Added tests for default values.
* System.Xml_test.dll.sources: Added tests for default values of Xml
Serialization attribute classes.
* SoapAttributeAttribute.cs: Return zero-length string if AttributeName or
DataType are null.
* SoapEnumAttribute.cs: Return zero-length string if Name is null.
* SoapIncludeAttribute.cs: Avoid using property in ctor.
* SoapSchemaMember.cs: Return zero-length string if MemberName is
null. MemberType should be XmlQualifiedName.Empty by default.
* SoapTypeAttribute.cs: Return zero-length string if TypeName is
null. Avoid using property in ctor.
* XmlArrayAttribute.cs: Return zero-length string if ElementName is
null. Avoid using property in ctor.
* XmlArrayItemAttribute.cs: IsNullable must be false by default.
Return zero-length string if DataType or ElementName are null. Avoid
using property in ctor.
* SoapElementAttribute.cs: Return zero-length string when DataType
or ElementName are null. Avoid using property in ctor.
* XmlAnyElementAttribute.cs: Return zero-length string when Name is
null. Avoid using property in ctor.
* XmlAttributeAttribute.cs: Avoid using property in ctor. Return
zero-length string if AttributeName or DataType are null.
* XmlChoiceIdentifierAttribute.cs: Return zero-length string when
MemberName is null.
* XmlElementAttribute.cs: Return zero-length string when DataType or
ElementName are null. Avoid using property in ctor.
* XmlEnumAttribute.cs: Avoid using property in ctor.
* XmlIncludeAttribute.cs: Avoid using property in ctor.
* XmlReflectionImporter.cs: AttributeName, ElementName and DataType
can no longer be null. Use check for zero-length string to determine
whether they are set. Corrected exception message when DataType is
set for complex type.
* XmlRootAttribute.cs: Return zero-length string if DataType or
ElementName are null. Avoid using property in ctor.
* XmlTextAttribute.cs: Return zero-length string if DataType is null.
* XmlTypeAttribute.cs: Return zero-length string if TypeName is null.
svn path=/trunk/mcs/; revision=47896
* XmlReflectionImporter.cs: Don't ignore type namespaces explicitely
set to the default namespace. This fixes bug #73035.
svn path=/trunk/mcs/; revision=45186
* XmlReflectionImporter.cs:
* SoapReflectionImporter.cs:
* TypeTranslator.cs: Encode local names withXmlConvert.EncodeLocalName
where needed. Based on a patch by Konstantin Triger.
svn path=/trunk/mcs/; revision=43003