24 Commits
Author SHA1 Message Date
Alexander Köplinger 8ce85205d9 [System.Runtime.Serialization] Switch tests to use embedded test resources 2018-09-27 22:47:04 +02:00
Andi McClure b04a3a355f Support SerializeObjectState for System.Exception (bug #39824)
Per current .NET, exception serialization may be implemented using the
SerializeObjectState event. Use of this approach is mandatory for
certain classes, such as HttpRequestException subclasses. Mono does
not support it. The solution is to switch out our System.Exception
implementation for the referencesource one.

To accommodate this, classes that access System.Exception internal
fields directly must switch to the new field names; a new support
method is added to System.Environment; the "security level" methods
and icall are added to MonoCMethods; and the field order in
_MonoException must be adjusted. A new test is also added in the
System.Runtime.Serialization assembly.
2016-04-13 18:36:08 -04:00
Aaron Bockover f76b8b4df1 XmlObjectSerialier: fix ISerializable (bxc#37171)
The shim/bridge between Mono and the RS implementation of
XmlObjectSerializer, DataContractSerializer, etc. did not properly
invoke the constructor required by ISerializable, as it completely
omitted passing the populated SerializationInfo object.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=37171
2015-12-21 11:00:46 -05:00
Miguel de Icaza ae8d66d6a9 [System.Runtime.Serialization] Static serializer calls directly into internal APIs to fix C6 regression
With C6 we introduced a regression
https://bugzilla.xamarin.com/show_bug.cgi?id=36100, which is caused by
the new static serialization code that we wrote to reuse Microsoft's
serializer.

The code uses Invoke on a series of MethodInfos, and this obscures the
actual code that will be invoked at runtime to serialize certain
objects, causing the following exception:

Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_bool_Nullable`1<Decimal> (object,intptr,intptr,intptr)' while running with --aot-only.

This patch makes the simple code work, but a more thorough review of
the code would allow us to remove many of the slow dynamic codepaths
in the serializer.

We opted for that approach to keep the code as similar as possible to the
original.

But the code basically does this:

* Use the XmlFormatGeneratorStatics property InternalSerializeMethod,
  whose sole purpose is to delay computing the MethodInfo for the
  XmlFormatWriterGenerator's InternalSerialize.

* Use the resulting method in a few places to call the MethodInfo.

The MethodInfo was used because the original code uses Reflection.Emit
to create fast serializers and it needs handles to internal methods,
but our static rewriter does not need it.

We should replace all of those uses, but for now, this patch at least
deals with the 36100 bug.
2015-12-04 13:54:48 -05:00
Alexander Köplinger 308d25f67f [System.ServiceModel.Web] Move System.Runtime.Serialization.Json tests into System.Runtime.Serialization assembly
That's where they belong on .NET 4.5+

Additionally, add a test case from https://bugzilla.xamarin.com/show_bug.cgi?id=4230
2015-10-31 01:10:35 +01:00
Jose Donizetti 1690b16a73 add IsAny=true support for DataContractSerializer 2014-05-22 23:01:16 -04:00
Miguel de Icaza 1d1f618de4 Add tests for bug #15574, pull request 819 2014-02-12 15:39:24 -05:00
Martin Baulig 91f11b20d7 Bug #5829: DataContractSerializer should not check for invalid characters. 2013-03-22 01:00:56 +01:00
Martin Baulig ea570f3a76 [WCF,Serialization] Improve and fully implement support for collection types.
* System.Runtime.Serialization/XsdDataContractImporter:
      Check ImportOptions.ReferencedCollectionTypes to determine the proxy type.

* System.ServiceModel.Description/MetadataImporter.cs:
      Very simply implementation of the 'State' property.

* System.ServiceModel.Description/DataContractSerializerMessageContractImporter.cs:
      Use it here.

* Test/Resources/WSDL: Added some sample .wsdl files for the new tests; adding
      these as resources to the test dll.

* Test/System.Runtime.Serialization: Added WsdlHelper.cs,
      XsdDataContractImporterTest2.cs and XsdDataContractExportTest2.cs
2012-10-09 23:04:08 +02:00
Martin Baulig e5e80eeae1 [#7299][Serialization]: Fixed and improved collection serialization.
* Implement "Interchangeable Collections" and Collection Interface Types.
  (see http://msdn.microsoft.com/en-us/library/aa347850.aspx)

* Add element type check for arrays.

* Identify custom collection types (must have a public parameterless
  constructor and an "Add" method with the correct argument type) and
  distinguish them from types which implement one or more of the
  collection interfaces without being a custom collection type.

* Add some checks for [CollectionDataContract].

* Added some NUnit tests for that.
2012-09-25 03:23:19 +02:00
Vinicius Jarina b7b6bbea57 Added unit test for the bug #242 2012-05-30 16:03:02 -03:00
Vinicius Jarina aa6c3ddc4c Added unit test for the bug #3258 (Serialize|Deserialize DateTimeOffset?) 2012-05-08 16:53:15 -03:00
Dave Ferguson 3b6cb0a486 Fix DataContractSerializer with duplicate qname
- Fix bug 4794 by searching the SerializationMap with both type and
  qname in all but several cases (see bug report comments)

- Add separate list for known types to mimic behavior of the .NET
  runtime

- Make previous test fixtures public so that the unit tests will be run

- Remove unused private method

- Add unit test for bug 4794
2012-05-03 01:56:17 -04:00
Vinicius Jarina 32b939f496 Add unit test for bug 2843 (Serialization/Deserialization Nullable Enum). 2012-03-10 21:01:34 -03:00
Atsushi Eno e0be05d381 Look for KnownTypeAttributes on known types (recursively). Fixed bug #695203. 2011-05-23 19:27:55 +09:00
Atsushi Eno be5f140d36 Implement support for KnownTypeAttribute.MethodName. 2011-04-15 15:40:42 +09:00
Atsushi Eno d7796bf493 In some collection case, xsi:type is explicitly written. Try to copy that behavior. 2011-03-10 14:33:02 +09:00
Atsushi Eno 8e916dc39c There's a tricky namespace-mismatching deserialization in .NET implementation.
Fixed bug #666333.
2011-02-08 17:09:26 +09:00
Atsushi Eno 47fd1c3a33 Implement DataContractResolver support. At least TryResolveType in serializer should work. 2010-10-05 00:08:15 +09:00
Atsushi Eno 02a3560fa3 2009-04-02 Atsushi Enomoto <[email protected]>
* XmlMtomDictionaryWriter.cs : new.
	* XmlDictionaryWriter.cs : implement CreateMtomWriter().

	* XmlMtomDictionaryWriterTest.cs : new.

	* System.Runtime.Serialization.dll.sources : added mtom writer.
	* System.Runtime.Serialization_test.dll.sources : added mtom writer test.


svn path=/trunk/mcs/; revision=130849
2009-04-02 09:58:04 +00:00
Jonathan Pryor c8f1af3dd7 * System.Runtime.Serialization_test.dll.sources: Add
System.Xml/XmlDictionaryWriterTest.cs to the test build.
	* System.Xml/XmlDictionaryWriter.cs (WriteStartElement): Add parameter 
	  checking and default arguments to avoid NullReferenceExceptions.
	* Test/System.Xml/XmlDictionaryWriterTest.cs: Added; test
	  XmlDictionaryWriter.WriteElementString().

svn path=/trunk/mcs/; revision=126751
2009-02-12 19:47:59 +00:00
Jonathan Pryor 79d3cca79c * System.Runtime.Serialization_test.dll.sources: Add
System.Xml/XmlDictionaryStringTest.cs to the test build.
	* System.Xml/XmlDictionaryString.cs: Add constructor argument checking.
	* Test/System.Xml/XmlDictionaryStringTest.cs: Added; tests for 
	  XmlDictionaryString.

svn path=/trunk/mcs/; revision=126680
2009-02-12 03:43:25 +00:00
Atsushi Eno 628a182954 2008-11-23 Atsushi Enomoto <[email protected]>
* System.Runtime.Serialization_test.dll.soruces :
	  remove ALL Mainsoft serialization tests that completely fail under
	  .NET and reduce 107 test failures out of 113.
	  They are English (language) dependent.


svn path=/trunk/mcs/; revision=119730
2008-11-23 04:37:37 +00:00
Jb Evain 8b9722d103 move to from olive to mcs
svn path=/trunk/mcs/; revision=111184
2008-08-20 21:22:38 +00:00