Commit Graph
14 Commits
Author SHA1 Message Date
Sebastien Pouliot 13ff02dc31 [System.ServiceModel.Web] Fix issue with types explicitly implementing IDictionary or IDictionary<,>
Issue: The previous code, with new tests [1], failed when the linker was
enabled.

That was caused because the code looks for the Keys and Item properties
getter using reflection. The linker handled that imperfectly (it left
some holes), in part because:

* System.Collections.Generic.IDictionary`2 does not implement
  System.Collections.IDictionary; and

* It preserved the explicit methods - not the implicit one that were
  used the the reflection-based code;

That later fact is also a bug (without the linker involvment) and solved
by this commit. A unit test was added to show the issue (NRE).

The patch also avoid the use of reflection for IDictionary since we can
simply typecast to get the same result (without the additional cost).
2014-05-26 17:27:26 -04:00
Antoine Cailliau b2b269b1e8 [Fix] DataContractJsonSerializer fails serializing/deserializing collections 2014-04-16 15:10:17 +02:00
Atsushi Eno 382a385a8f Collection support in JSON serializer was actually for any IEnumerable. 2011-04-05 20:55:32 +09:00
Atsushi Eno 7a32f7a4a1 null value also outputs "type='null' in WCF JSON writer. 2011-04-05 19:47:54 +09:00
Atsushi Eno 3f0fe0dcde IDictionary`2 serialization support was missing in DataContractJsonSerializer.
Fixed bug #685042.
2011-04-05 13:19:54 +09:00
Andreia Gaita 987ef9dbab [Json] Add support for calling external json (de)serialization methods
On Moonlight, ScriptObject types have custom (de)serialization methods that
need to be called whenever a user object includes properties of that type.
This patch creates a TypeMap subclass (ExternalTypeMap) and exposes a method
that can be called from moon's System.Windows.Browser to register custom
serialization and deserialization methods, keyed by type. These are called
whenever a property is found with a type (or base type) that has custom
methods registered.
2010-10-16 19:58:08 +01:00
Andreia Gaita ef2049a2b6 [Json] Fix decimal type serialization 2010-10-16 19:58:08 +01:00
Rolf Bjarne Kvinge f7a0fde4c6 JsonSerializationWriter: handle char values 2010-09-24 12:11:36 +02:00
Andreia Gaita 4a6ea9c095 Add serialization support for generic IDictionary objects
* JsonSerializationReader.cs, JsonSerializationWriter.cs:
  Add a special case for IDictionary, since KeyValuePair objects
  have private setters and can't be processed via the normal
  object code path.
2010-07-27 20:08:15 +01:00
Atsushi Eno b79dda6c6d 2010-07-06 Atsushi Enomoto <[email protected]>
* JsonSerializationWriter.cs : it cannot serialize DateTime in
	  double, which causes crash in deserializer.


svn path=/trunk/mcs/; revision=159945
2010-07-06 09:21:34 +00:00
Atsushi Eno 2e11b2e4fa 2010-03-09 Atsushi Enomoto <[email protected]>
* JsonSerializationWriter.cs, JsonSerializationReader.cs,
	  JsonWriter.cs : Fix DateTime serialization and "\/" string escape
	  issues. Fixed bug #586169.

	* DataContractJsonSerializerTest.cs : add test for bug #586169.
	* JsonWriterTest.cs : add standalone write case for "\/".


svn path=/trunk/mcs/; revision=153318
2010-03-09 11:21:24 +00:00
Atsushi Eno ae41bed338 2009-10-08 Atsushi Enomoto <[email protected]>
* DataContractJsonSerializer.cs, JsonSerializationWriter.cs:
	  alwaysEmitTypeInformation is  false by default. It is for __type
	  attribute, not for type attribute. __type name is always with ":#".
	* TypeMap.cs : sort members in default typemap (it is ordered).
	  Uncomment EmitDefaultValue.
	* JsonWriter.cs : handle "null" string (it is somewhat messy).

	* WebMessageEncoder.cs : use alwaysEmitTypeInformation to output
	  object __type.

	* DataContractJsonSerializerTest.cs : added test for
	  alwaysEmitTypeInformation argument.


svn path=/trunk/mcs/; revision=143748
2009-10-08 09:55:36 +00:00
Atsushi Eno 42e9eccb49 2009-09-22 Atsushi Enomoto <[email protected]>
* JsonSerializationWriter.cs : output "type" attribute on bool
	  values too.
	* JsonSerializationReader.cs : type loading attempt was insufficient
	  and hence often missed indicated types to deserialize.


svn path=/trunk/mcs/; revision=142423
2009-09-22 17:30:32 +00:00
Jb Evain 982e3b35a4 move to from olive to mcs
svn path=/trunk/mcs/; revision=111188
2008-08-20 21:25:05 +00:00