43 Commits
Author SHA1 Message Date
Maxim Lipnin 9988ebc7f2 [System.Xml] Fix deserialization issue (#16965)
[This ](https://github.com/mono/mono/pull/11194/files#diff-ae54d9565e735005686191de0f19ed50R431-R435)change in `XmlTypeMapElementInfo.GetElement`  introduced the logic for handling the case of derived types deserialization. 
For some cases (like https://github.com/mono/mono/issues/16918) it breaks existing functionality because it returns wrong element for given element name after searching withing derived types collection.

![image](https://user-images.githubusercontent.com/3258267/65416085-bedc0500-ddff-11e9-941c-f24045c64121.png)

Unfortunately, what I can do here is just reverting the related changes.

Fixes https://github.com/mono/mono/issues/16918
2019-09-24 11:35:15 +02:00
majellin24 92711632bf Modification to allow deserialization of derrived types (#11194)
* Modification to allow deserialization of derrived types

* white space correction

* second attempt

* third attempt

* fourth

* whitespace

* maybe fix null ref exception

* missed same condition in other method

* fixing condition

* hopefully correcting the test failure in AOT

* Modification to allow deserialization of derrived types

white space correction

second attempt

third attempt

fourth

whitespace

maybe fix null ref exception

missed same condition in other method

fixing condition

hopefully correcting the test failure in AOT

formatting

missed some formatting

* adding a test for PR #11194

* fixing a few exceptions

* adding ref
2018-10-31 10:43:46 +01:00
Marek Safar d19e5c42a5 [System.Xml] Update supported time formats for mobile version of XML deserializer. Fixes #42843 2016-10-14 09:10:17 +02:00
Marek Safar aac0b374df [system.xml] One more mobile serialization incompatibility 2015-05-20 20:32:23 +02:00
Marek Safar 7215f95d58 [bcl] Mobile profiles fixes 2015-05-20 12:56:36 +02:00
Marek Safar 401a35cd69 [system.xml] Serialization from reference sources for desktop 2015-05-13 18:47:07 +02:00
Atsushi Eno ddca46d22b Revert "[system.xml] Serialization from reference sources for desktop"
This reverts commit 6ae517ea65.
2015-05-12 14:42:19 +08:00
Marek Safar 6ae517ea65 [system.xml] Serialization from reference sources for desktop 2015-05-11 15:37:01 +02:00
Alexander Köplinger 746650d1b9 [bcl] Remove more NET_2_0 checks from class libs 2015-01-17 05:45:39 +01:00
Lluis Sanchez 0c2e8c9455 Add some unit tests for bug 9193 2013-01-09 13:43:56 +01:00
Lluis Sanchez 3a6c0cf166 Add tests for bug #8468
Conflicts:

	mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
2012-11-19 21:21:03 +01:00
Andres G. Aragoneses 48c73cfb3c [System.XML]: Do not set XmlTypeMapElementInfo.IsNullable if it's already True
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
2012-10-03 12:08:16 +01:00
Lluis Sanchez aabbc960b7 Improve date serialization compatibility with third party web services
Make XmlCustomFormatter.cs more liberal about the date formats it accepts.
Many third party web services do not format date exactly at 'yyyy-mm-dd'.
The Microsoft implementation is more liberal about accepting other formats
and so the current Mono implementation breaks projects that consume third
party web services when they are ported to Mono.
Based on a patch by Aaron Roydhouse.
2012-06-05 12:35:52 +02:00
Marek Safar c81c35a8c6 Fix more xml serializer tests 2012-05-31 13:23:55 +01:00
Rolf Bjarne Kvinge b3014f2bcc Fix XmlAttributes to ignore all XmlAttributes if XmlIgnore is present 2012-04-19 23:04:16 +02:00
Rolf Bjarne Kvinge 5d7c168eba Ignore XmlIgnore attributes when importing members in XmlReflectionImporter. Fixes #4367. 2012-04-19 23:04:15 +02:00
Atsushi Eno 8688f906c3 2008-06-05 Atsushi Enomoto <[email protected]>
* 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
2008-06-05 11:28:51 +00:00
Konstantin Triger 28a2fbb8dd TARGET_JVM: #7458 is fixed
svn path=/trunk/mcs/; revision=76890
2007-05-08 06:45:54 +00:00
Konstantin Triger 5147da7b64 TARGET_JVM: Ignore failing tests
svn path=/trunk/mcs/; revision=73607
2007-03-01 16:39:21 +00:00
Atsushi Eno ab26e417d8 2007-02-07 Atsushi Enomoto <[email protected]>
* DeserializeTests.cs : a lot of tests were actually fixed yet.


svn path=/trunk/mcs/; revision=72433
2007-02-07 16:33:45 +00:00
Gert Driesen c590893933 * XmlSerializerTests.cs: Only compile generic tests on 2.0 profile.
Fixes build.
* DeserializeTests.cs: Same.
* XmlSerializerTestClasses.cs: Same.

svn path=/trunk/mcs/; revision=68888
2006-12-03 14:14:20 +00:00
Yoni Klain acef74c489 2006-12-03 Hagit Yidov <[email protected]>
* XmlSerializerTests.cs : added tests for serialization of generic types.
	* DeserializeTests.cs : added tests for deserialization of generic types.
	* XmlSerializerTestClasses.cs : added classes for tests which use generic types.

svn path=/trunk/mcs/; revision=68886
2006-12-03 12:28:23 +00:00
Tal Klahr 9867e1cc09 Reverting r68577
svn path=/trunk/mcs/; revision=68588
2006-11-28 14:50:54 +00:00
Hagit Yidov d27d092b14 ChangeLog, DeserializationTests, XmlSerializerTestClasses.cs, XmlSerializerTests.cs
Added serialization and deseralization tests for generic types.

svn path=/trunk/mcs/; revision=68577
2006-11-28 13:06:44 +00:00
Atsushi Eno 3b1767cacf eol-style:native.
svn path=/trunk/mcs/; revision=67663
2006-11-10 10:13:46 +00:00
Gert Driesen b5eb88c87f * DeserializeTest.cs: Added several tests.
* 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
2006-10-10 17:53:49 +00:00
Gert Driesen 2bfaa4cc5c * DeserializeTests.cs: Improved TestDeserialize_Enum test for
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
2006-04-26 09:56:45 +00:00
Gert Driesen 9c4805562a * DeserializeTests.cs: Enabled tests for bug #77530.
* 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
2006-03-10 04:37:54 +00:00
Gert Driesen 2c926f4814 * XmlSerializerTests.cs: Numbered some tests.
* DeserializerTests.cs: Added tests for deserialization of enums, and primitive
types container.

svn path=/trunk/mcs/; revision=56768
2006-02-10 18:50:02 +00:00
Gert Driesen fe970fe414 * DeserializeTests.cs: Use Assert instead of deprecated Assertion. Renumbered
tests. Fixed line endings.

svn path=/trunk/mcs/; revision=56579
2006-02-06 10:39:27 +00:00
Lluis Sanchez 6074454762 2005-12-05 Lluis Sanchez Gual <[email protected]>
* 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
2005-12-05 20:44:42 +00:00
Lluis Sanchez b63a5f42e9 2005-09-26 Lluis Sanchez Gual <[email protected]>
* XmlSerializerTests.cs, DeserializeTests.cs, 
	XmlSerializerTestClasses.cs: Added tests for serialization of
	arrays of choice values.


svn path=/trunk/mcs/; revision=50785
2005-09-26 16:15:47 +00:00
Lluis Sanchez 4f5a2dd8a8 2005-08-24 Lluis Sanchez Gual <[email protected]>
* XmlSerializerTests.cs: Added test for bug #75855.
	* DeserializeTests.cs: New test.
	* XmlSerializerTestClasses.cs: New test classes.


svn path=/trunk/mcs/; revision=48802
2005-08-24 18:09:51 +00:00
Lluis Sanchez 2bb89efdaf 2005-04-26 Lluis Sanchez Gual <[email protected]>
* XmlSerializerTests.cs:
	* DeserializeTests.cs:
	* XmlSerializerTestClasses.cs: Added tests for readonly properties and
	elements with spaces on them.


svn path=/trunk/mcs/; revision=43585
2005-04-26 09:20:55 +00:00
Lluis Sanchez 539cf95e9c 2005-03-30 Lluis Sanchez Gual <[email protected]>
* XmlSerializerTests.cs:
	* XmlReflectionImporterTests.cs:
	* DeserializeTests.cs:
	* XmlSerializerTestClasses.cs: Added tests for serialization of choices.


svn path=/trunk/mcs/; revision=42417
2005-03-31 08:40:30 +00:00
Lluis Sanchez 1466ec3475 2005-03-29 Lluis Sanchez Gual <[email protected]>
* XmlSerializerTests.cs:
	* DeserializeTests.cs: 
	* XmlSerializerTestClasses.cs: Added some tests for xml node serialization.


svn path=/trunk/mcs/; revision=42329
2005-03-29 11:42:18 +00:00
Nick Drochak 9a15491ff7 2005-02-10 Nick Drochak <[email protected]>
* DeserializeTests.cs: Ignore new test on MS.NET, since it fails there.

svn path=/trunk/mcs/; revision=40361
2005-02-10 01:21:14 +00:00
Lluis Sanchez 1a7c6e0cda 2005-02-07 Lluis Sanchez Gual <[email protected]>
* DeserializeTests.cs: Added test case for bug #72265.


svn path=/trunk/mcs/; revision=40254
2005-02-07 17:45:51 +00:00
Nick Drochak e0d1a77a98 2005-01-30 Nick Drochak <[email protected]>
* ComplexDataStructure.cs:
	* DeserializationTests.cs: Ignore failures on .NET

svn path=/trunk/mcs/; revision=39799
2005-01-30 14:06:09 +00:00
Lluis Sanchez 2d39f2bd3d * XmlSerializerTestClasses.cs: Added some test classes.
* DeserializeTests.cs: Added tests for bug #61464.

svn path=/trunk/mcs/; revision=33231
2004-09-02 16:12:57 +00:00
Lluis Sanchez 06cd746bed * DeserializeTests.cs: Added test for empty enum deserialization (bug #55509).
* XmlAttributesTests.cs, XmlReflectionImporterTests.cs,
	  XmlSerializationWriterTests.cs, XmlSerializerTests.cs:
	  Simplified namespace hierarchy.
	* XmlSerializerTestClasses.cs: Added more test classes.

svn path=/trunk/mcs/; revision=23956
2004-03-12 15:55:33 +00:00
Lluis Sanchez 9f8ae02700 * DeserializeTests.cs, XmlAttributesTests.cs: Changed namespace.
* XmlSerializationWriterTests.cs, XmlSerializerTests.cs: Make xml compares
	  independent from the text format.

svn path=/trunk/mcs/; revision=21319
2003-12-18 12:55:37 +00:00
Atsushi Eno c0645bd71d 2003-05-20 Atsushi Enomoto <[email protected]>
* added DeserializeTests.cs and XmlAttributesTest.cs

svn path=/trunk/mcs/; revision=14714
2003-05-20 03:54:35 +00:00