Commit Graph
45 Commits
Author SHA1 Message Date
Andreia Gaita 778694e1b8 Add support for deserializing Char types
* JsonSerializationReader.cs: Add Char type to the switch. Reads the
  content as a string and validates its length
2010-07-27 20:12:02 +01: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 3e59168e9d 2010-07-06 Atsushi Enomoto <[email protected]>
* TypeMap.cs :
	  Do not try to add static members as serialization targets.
	  Support OnDeserializing and OnDeserialized. Fixed bug #615800.

	* DataContractJsonSerializerTest.cs : add test for bug #615800.


svn path=/trunk/mcs/; revision=159958
2010-07-06 13:41:08 +00: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 6ce2b49f94 2010-07-06 Atsushi Enomoto <[email protected]>
* TypeMap.cs : when an object is null, return null, not just an 
	  uninitialized object.

	* DataContractJsonSerializerTest.cs : add test for bug #615801.


svn path=/trunk/mcs/; revision=159944
2010-07-06 09:08:57 +00:00
Atsushi Eno 4efe543e9f 2010-07-06 Atsushi Enomoto <[email protected]>
* DataContractJsonSerializer_2_1.cs : add extra methods for
	  Sys.SM.Web.Extensions build.

	* WebMessageFormatter.cs : add NET_2_1 profile build.

	* AssemblyInfo.cs : InternalVisibleTo System.ServiceModel.Web.Extensions.


svn path=/trunk/mcs/; revision=159943
2010-07-06 08:59:28 +00:00
Atsushi Eno 13e5341363 2010-07-06 Atsushi Enomoto <[email protected]>
* JsonReader.cs : do not keep Attribute state once Read() is called.


svn path=/trunk/mcs/; revision=159942
2010-07-06 08:53:58 +00:00
Atsushi Eno 02c1565c69 2010-04-24 Atsushi Enomoto <[email protected]>
* JsonSerializationReader.cs : use List<T> if the contract
          member type is interface.


svn path=/trunk/mcs/; revision=156039
2010-04-24 07:11:05 +00:00
Jb Evain e1dc31d7ab use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153653
2010-03-16 10:53:59 +00:00
Kornél Pál 85ceae01fd JavaScriptReader.cs: Deserialize false correctly. Fixed bug #586712.
svn path=/trunk/mcs/; revision=153536
2010-03-13 09:48:25 +00:00
Atsushi Eno 6f0cd4a650 2010-03-10 Atsushi Enomoto <[email protected]>
in System.ServiceModel.Web:
	* JavaScriptReader.cs : moved from Sys.Json/JsonReader.cs.

	* net_2_0_System.ServiceModel.Web.dll.sources,
	  net_2_1_raw_System.ServiceModel.Web.dll.sources :
	  move JsonReader.cs as Sys.R.S.Json/JavaScriptReader.cs

in System.Json:
	* JsonReader.cs : moved to Sys.SM.Web/Sys.R.S.Json.

	* System.Json.dll.sources : remove JsonReader.cs.


svn path=/trunk/mcs/; revision=153393
2010-03-10 10:22:36 +00:00
Atsushi Eno 286c255027 2010-03-10 Atsushi Enomoto <[email protected]>
in System.ServiceModel.Web:
	* JavaScriptObjectDeserializer.cs : new internal file, which is
	  used by System.Json (for moonlight compatibility).

	* net_2_0_System.ServiceModel.Web.dll.sources,
	  net_2_1_raw_System.ServiceModel.Web.dll.sources :
	  add JavaScriptObjectDeserializer.cs and JsonReader in Sys.Json
	  (which is to be moved later).

	* AssemblyInfo.cs: added InternalVisibleTo(System.Json). Also added
	  dummy 2.0 for easy testing.

in System.Json:

	* JsonValue.cs : use Sys.SM.Web.dll's JavaScriptObjectDeserializer
	  for silverlight sdk / moonlight compatibility.
	* JsonReader.cs : renamed to JavaScriptReader (for disambiguation in
	  Sys.SM.Web.dll). Now it is native-type based and used by the above
	  deserializer.

	* Makefile : reference System.Xml and System.ServiceModel.Web (for
	  moonlight compatibility).

	* AssemblyInfo.cs : use the same pub key in 2.0 (dummy), to ease
	  testing locally.



svn path=/trunk/mcs/; revision=153392
2010-03-10 10:17:24 +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 a7b1a7ee44 2010-02-24 Atsushi Enomoto <[email protected]>
* JsonWriter.cs : write NaN, INF, -INF as JSON string, not JSON number.
	  Fixed bug #573691.


svn path=/trunk/mcs/; revision=152342
2010-02-24 09:46:11 +00:00
Atsushi Eno 9579012ec5 2010-01-27 Atsushi Enomoto <[email protected]>
* DataContractJsonSerializer.cs : KnownTypes does not include root
	  type. Fixed bug #573689.

	* DataContractJsonSerializerTest.cs :
	  enable TypeIsNotPartsOfKnownTypes(), and add more related tests.


svn path=/trunk/mcs/; revision=150279
2010-01-27 06:17:48 +00:00
Atsushi Eno 1c2432b083 2010-01-27 Atsushi Enomoto <[email protected]>
* JsonSerializationReader.cs : oops, wrong fix, should consume the
	  reader.


svn path=/trunk/mcs/; revision=150277
2010-01-27 05:42:33 +00:00
Atsushi Eno 6cd5a57fc3 2010-01-27 Atsushi Enomoto <[email protected]>
* JsonSerializationReader.cs : "null" for string should be read as
	  null, not String.Empty. Fixed bug #573690.

	* DataContractJsonSerializerTest.cs : null-string case is working.


svn path=/trunk/mcs/; revision=150276
2010-01-27 05:36:54 +00:00
Sebastien Pouliot 0f34c4b534 2010-01-26 Sebastien Pouliot <[email protected]>
* DataContractJsonSerializer_2_1.cs: Don't hide [Field|Method]
	AccessException inside a SerializationException but in a 
	SecurityException.


svn path=/trunk/mcs/; revision=150219
2010-01-26 18:32:30 +00:00
Sebastien Pouliot 21bda63388 2010-01-25 Sebastien Pouliot <[email protected]>
* DataContractJsonSerializer_2_1.cs: New. Simpler version for 
	Moonlight since it does not inherit from the same base type nor
	does it overrides any base methods.


svn path=/trunk/mcs/; revision=150149
2010-01-25 20:58:11 +00:00
Atsushi Eno f30add0fba 2010-01-08 Atsushi Enomoto <[email protected]>
* TypeMap.cs : forward port r145077 (see change line for 2009-10-29).


svn path=/trunk/mcs/; revision=149212
2010-01-08 04:28:58 +00:00
Atsushi Eno 0ede800ea0 2009-12-14 Atsushi Enomoto <[email protected]>
* TypeMap.cs : handle [Serializable] objects such as KeyValuePair<,>
	  like we do in 2.0. Removed previous workarounds. (Do not serialize
	  and deserialize nonpublic members in "default" mappings.)


svn path=/trunk/mcs/; revision=148364
2009-12-14 03:36:28 +00:00
Chris Toshok f231a6cb9b in System.Runtime.Serialization.Json:
2009-12-11  Chris Toshok  <[email protected]>

	* TypeMap.cs (CreateDefaultTypeMap): only include non-public
	property info when dealing with KeyValuePair<,>.  This is *not*
	the way MS handles it, but we emulate things much better with this
	hack.

in test/System.Runtime.Serialization.Json/:
2009-12-11  Chris Toshok  <[email protected]>

	* DataContractJsonSerializerTest.cs: add a test case for
	non-public properties.


svn path=/trunk/mcs/; revision=148184
2009-12-12 00:14:23 +00:00
Atsushi Eno 6557535276 2009-12-11 Atsushi Enomoto <[email protected]>
* JsonReader.cs : e- and e+ was resulting in wrong parse error.
	  This should fix part of bug #531904.

	* JsonReaderTest.cs : another number parse case.


svn path=/trunk/mcs/; revision=148099
2009-12-11 12:54:10 +00:00
Chris Toshok 4e5653512f 2009-12-08 Chris Toshok <[email protected]>
* JsonSerializationReader.cs (DeserializeGenericCollection): in
	the 2.1 case we still need to convert the List<> to an array.

svn path=/trunk/mcs/; revision=147835
2009-12-08 08:05:31 +00:00
Chris Toshok 7297458838 in System.ServiceModel.Web/System.Runtime.Serialization.Json:
2009-12-07  Chris Toshok  <[email protected]>

	* JsonReaderWriterFactory.cs (CreateJsonReader): pass null for the
	encoding parameter instead of calling Detect.  The jsonreader's
	PushbackReader will autodetect.
	(Detect): remove.  a BufferedStream created from an unseekable
	stream is itself unseekable, which makes it just as useless.  This
	breaks netflix's isostore file parsing.

	* JsonReader.cs (PushbackReader): add a ctor which doesn't take an
	encoding, for the autodetecting reader case.  for this ctor, pass
	true to StreamReader's ctor for detectEncodingFromByteOrderMarks.

svn path=/trunk/mcs/; revision=147829
2009-12-08 04:56:29 +00:00
Chris Toshok 8718686805 in class/corlib/System.Collections.Generic/:
2009-12-06  Chris Toshok  <[email protected]>

	* KeyValuePair.cs: we need setters for Key and Value so they can
	be set via reflection from
	System.ServiceModel.System.Runtime.Serialization.Json.TypeMap.cs.

in class/System.ServiceModel.Web/System.Runtime.Serialization.Json/:
2009-12-06  Chris Toshok  <[email protected]>

	* JsonSerializationReader.cs (DeserializeGenericCollection): this
	is jb's (iirc) patch, actually.  Types subclassing from
	ICollection<T> need to be supported, and since it's an interface
	the implementation might be explicit.  So instead of groveling
	around in the actual type, we need to dispatch through the
	interface's method.

	* TypeMap.cs (CreateDefaultTypeMap): we need to include non-public
	properties, since KeyValuePair items must be able to write to Key
	and Value properties.

	* JsonReader.cs (ReadContent): for builtin values (null, true,
	false), use TryReadString instead of individual ReadChar's, since
	they aren't reversible if the string didn't match.  In the default
	case, if we're LameSilverlightLiseralParser, we need to push back
	the current character onto the stream -- this is because for
	netflix's AppConfig.json we were parsing "frameRatePolicy" as
	"rameRatePolicy" (the 'f' was triggering the "false" parsing).
	(class PushBackReader): add this class to unify all the pushing
	back of characters we need to do.  1 character (JsonReader's old
	"saved_char") isn't enough given that you could have a property
	named, e.g., "falsifiable", and we'd need 4 characters worth of
	pushback to recognize that correctly.

svn path=/trunk/mcs/; revision=147766
2009-12-07 07:39:17 +00:00
Atsushi Eno f2689b52df 2009-11-20 Atsushi Enomoto <[email protected]>
* DataContractJsonSerializer.cs, JsonReader.cs : Silverlight uses
	  LAME parser that allows object member name as *raw* string
	  without double-quotes. (This also reverts the previous change.)

	* DataContractJsonSerializerTest.cs : added ignored test case that
	  verifies 2.1 behavior (with another case that justifies removal
	  of the previous hack).


svn path=/trunk/mcs/; revision=146599
2009-11-20 06:07:51 +00:00
Atsushi Eno 340cc5ba4d 2009-11-12 Atsushi Enomoto <[email protected]>
*  JsonSerializationReader.cs : reuse generic collection search
	  logic in KnownTypeCollection.cs. Fixed bug #551671.


svn path=/trunk/mcs/; revision=146023
2009-11-12 08:15:40 +00:00
Andreia Gaita 0c72dc2f85 * DataContractJsonSerializer.cs: SL accepts keys without "", so tweak
the data to fix the quotes before passing it to the deserializer

svn path=/trunk/mcs/; revision=145075
2009-10-30 02:23:40 +00:00
Atsushi Eno b5688b9e2d add experimental monotouch build.
svn path=/trunk/mcs/; revision=144701
2009-10-23 02:37:20 +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 b5eb01a3ae 2009-10-05 Atsushi Enomoto <[email protected]>
* JsonReader.cs : copy string literal parser from System.Json.


svn path=/trunk/mcs/; revision=143433
2009-10-05 18:47:34 +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
Atsushi Eno 437ac6f7c7 2009-09-15 Atsushi Enomoto <[email protected]>
* JsonWriter.cs : use Stream as its output directly and avoid
	  extraneous preamble output. Fix interop with .NET.


svn path=/trunk/mcs/; revision=141934
2009-09-15 09:34:51 +00:00
Atsushi Eno 559e9dc912 2009-09-07 Atsushi Enomoto <[email protected]>
* JsonReaderWriterFactory.cs : check null stream (fix test failure).


svn path=/trunk/mcs/; revision=141411
2009-09-07 09:46:09 +00:00
Andreia Gaita ae2770b9c3 2009-03-13 Andreia Gaita <[email protected]>
* JsonReader.cs: fix depth calculation
	* JsonReaderTest.cs: test for skip and depth (if depth fails, skip is affected)

svn path=/trunk/mcs/; revision=129240
2009-03-13 03:09:30 +00:00
Geoff Norton e26db4576d 2009-03-12 Geoff Norton <[email protected]>
* TypeMap.cs: Avoid checking the getter/setter information until after
        checking if we have the required attribute decorated.

svn path=/trunk/mcs/; revision=129232
2009-03-13 00:09:51 +00:00
Andreia Gaita 4302acae88 2009-03-12 Andreia Gaita <[email protected]>
* JsonReaderWriterFactory.cs: try to auto-detect encoding for streams
	without BOM

svn path=/trunk/mcs/; revision=129226
2009-03-12 23:40:03 +00:00
Chris Toshok 53fd125cbe In System.Runtime.Serialization/System.Xml:
2009-03-02  Chris Toshok  <[email protected]>

	* XmlBinaryDictionaryReader.cs, XmlSimpleDictionaryReader.cs: 2.1
	has HasValue.

In System.XML/System.Xml:
2009-03-02  Chris Toshok  <[email protected]>

	* XmlReader.cs, XmlTextReader.cs, XmlTextReader2.cs,
	EntityResolvingXmlReader.cs: 2.1 has HasValue.


In System.XML/Mono.Xml:
2009-03-02  Chris Toshok  <[email protected]>

	* SubtreeXmlReader.cs, XmlFilterReader.cs: 2.1 has HasValue.

In System.Xml.Linq/System.Xml.Linq:
2009-03-02  Chris Toshok  <[email protected]>

	* XNodeReader.cs: 2.1 has HasValue.

In System.ServiceModel.Web/System.Runtime.Serialization.Json:
2009-03-02  Chris Toshok  <[email protected]>

	* JsonReader.cs: 2.1 has HasValue.


svn path=/trunk/mcs/; revision=128406
2009-03-03 00:44:33 +00:00
Atsushi Eno 78c9e57f94 2009-02-02 Atsushi Enomoto <[email protected]>
* JsonReader.cs : show invalid input character in the error
          message.


svn path=/trunk/mcs/; revision=125341
2009-02-02 12:38:03 +00:00
Atsushi Eno 9359270470 2009-02-02 Atsushi Enomoto <[email protected]>
* TypeMap.cs : in 2.1 do not use non-2.1 CreateInstance().


svn path=/trunk/mcs/; revision=125338
2009-02-02 11:35:56 +00:00
Atsushi Eno 276f8e262c 2009-02-02 Atsushi Enomoto <[email protected]>
* TypeMap.cs : allow get-only collections. Note that they are not
	  always deserializable (in .NET either).

	* DataContractJsonSerializerTest.cs : fixed some tests to match
	  .NET RTM behavior. Added read-only collection case, (but [Ignore]d).


svn path=/trunk/mcs/; revision=125332
2009-02-02 10:50:33 +00:00
Atsushi Eno 70db8e61e3 2009-02-02 Atsushi Enomoto <[email protected]>
* TypeMap.cs : DataContractJsonSerializer in RTM does not seem to
	  reject contract-less types. So populate map for public members.
	* DataContractJsonSerializer.cs : close XmlWriter to flush stream
	  (and it closes the stream by default).

	* DataContractJsonSerializerTest.cs : added test for contract-less
	  serialization.

	* Makefile : add -d:NET_3_5.


svn path=/trunk/mcs/; revision=125328
2009-02-02 09:38:03 +00:00
Andreia Gaita 523919603d 2009-02-02 Andreia Gaita <[email protected]>
* JsonSerializationReader.cs : Use 2.1 "approved" calls for Enum.Parse
    and Convert.ChangeType

svn path=/trunk/mcs/; revision=125298
2009-02-02 02:52:45 +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