[Mono-bugs] [Bug 551671] New: Exception in DataContractJsonSerializer when deserializing JSON created by NETFX DataContractJsonSerializer
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Oct 31 15:07:40 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=551671
Summary: Exception in DataContractJsonSerializer when
deserializing JSON created by NETFX
DataContractJsonSerializer
Classification: Mono
Product: MonoTouch
Version: unspecified
Platform: Other
OS/Version: Mac OS X 10.6
Status: NEW
Severity: Blocker
Priority: P5 - None
Component: Class Libraries
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: christian.weyer at thinktecture.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Description of Problem:
THe MonoTouch DataContractJsonSerializer fails with an exception when
deserializing a JSON string into an object - the JSON was created by
DataContractJsonSerializer from .NET Framework 3.5 SP1.
Steps to reproduce the problem:
1.
private TResult Deserialize<TResult> (string data) where TResult : class
{
Debug.WriteLine ("data: " + data);
var ser = new DataContractJsonSerializer (typeof(TResult));
TResult result;
using (var ms = new MemoryStream (Encoding.UTF8.GetBytes (data)))
{
result = ser.ReadObject (ms) as TResult;
}
return result;
}
2.
Actual Results:
Exception:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. --->
System.Runtime.Serialization.SerializationException: Deserialization has failed
---> System.InvalidOperationException: Node type Element is not supported in
this operation. (line 1, column 14)
at System.Xml.XmlReader.ReadContentString (Boolean isText) [0x00000]
at System.Xml.XmlReader.ReadContentString () [0x00000]
at System.Xml.XmlReader.ReadContentAsString () [0x00000]
at System.Xml.XmlDictionaryReader.ReadContentAsString (Int32
maxStringContentLength) [0x00000]
at System.Xml.XmlDictionaryReader.ReadContentAsString () [0x00000]
at System.Xml.XmlDictionaryReader.ReadElementContentAsString () [0x00000]
at
System.Runtime.Serialization.Json.JsonSerializationReader.ReadInstanceDrivenObject
() [0x00000]
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject
(System.Type type) [0x00000]
at
System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection
(System.Type collectionType, System.Type elementType) [0x00000]
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject
(System.Type type) [0x00000]
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot ()
[0x00000]
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00000]
--- End of inner exception stack trace ---
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00000]
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlDictionaryReader reader, Boolean verifyObjectName) [0x00000]
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlDictionaryReader reader) [0x00000]
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.IO.Stream stream) [0x00000]
at iTecTeacher.MediaServiceClient.Deserialize[List`1] (System.String data)
[0x00000]
at iTecTeacher.MediaServiceClient.WebClient_DownloadStringCompleted
(System.Object sender, System.Net.DownloadStringCompletedEventArgs e) [0x00000]
at System.Net.WebClient.OnDownloadStringCompleted
(System.Net.DownloadStringCompletedEventArgs args) [0x00000]
at System.Net.WebClient.<DownloadStringAsync>m__D (System.Object state)
[0x00000]
Expected Results:
Should deserialize the JSON string to an object.
How often does this happen?
Always.
Additional Information:
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list