[mono-android] Mono For Android Unable to Serialise/Deserialise Datatables
Travis Scott
travis.scott at compacsort.com
Tue Feb 7 04:12:55 UTC 2012
this is my first question and I have tried to follow the formatting
guidelines as best I could, apologies if I have not. Thanks in advance for
any assistance
I am uni student working on a summer job making an android port of an
application from windows/windows mobile CE using mono for android. I have
basically been learning as I go so apologies if my terminology/knowledge is
a bit thin.
The application stores a local copy of an sqlite database and only updates
changes to the database when the user chooses to sync with the company
database. In order to do this it creates a datatable of changes which is
serialised so it can be sent over the network, however it seems that there
is some sort of incompatibility between the serialisaiton performed by the
host server and the serialisation performed by android. When attempting to
serialise the datatable I get the following exception:
Exception: "Cannot redefine the namespace for prefix '' used at current
element"
(Stacktrace below)
and when attempting to deserialise I get this exception
Exception: "Object reference not set to an instance of an object"
(Stacktrace below)
The code works when run on windows/windows mobile, so I guess we are really
just wondering if anyone out there has encountered something similar before
and knows of some requirement/formatting quirk in android we are missing. I
know that usually code snippets are appreciated but these exceptions seem to
be occurring in the mono library, and the code dealing with all of this is
encapsulated and I am not really dealing with it directly (as it is all .NET
they had hoped it would be a direct port), so I wouldn't know which part to
post, however if more detail is needed and someone can point me towards the
right functions I will post further information.
Regards, Travis
Serialize Stacktrace:
at System.Xml.XmlTextWriter.WriteEndAttribute () [0x0010c] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml/XmlTextWriter2
.cs:984 \n at System.Xml.DefaultXmlWriter.WriteEndAttribute () [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml/DefaultXmlWrit
er.cs:116 \n at System.Xml.XmlSimpleDictionaryWriter.WriteEndAttribute ()
[0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Xml/XmlSimpleDictionaryWriter.cs:97 \n at
System.Xml.XmlWriter.WriteAttributeString (System.String prefix,
System.String
localName, System.String ns, System.String value) [0x00025] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml/XmlWriter.cs:2
67 \n at System.Xml.XmlWriter.WriteAttributeString (System.String
localName,
System.String value) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml/XmlWriter.cs:2
51 \n at System.Xml.XmlDictionaryWriter.WriteXmlnsAttribute (System.String
prefix, System.String namespaceUri) [0x00077] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Xml/XmlDictionaryWriter.cs:396 \n at
System.Runtime.Serialization.DataContractSerializer.WriteStartObject
(System.Xml.XmlDictionaryWriter writer, System.Object graph) [0x00210] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/DataContractSerializer.cs:492 \n at
System.Runtime.Serialization.XmlObjectSerializer.WriteObject
(System.Xml.XmlDictionaryWriter writer, System.Object graph) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/XmlObjectSerializer.cs:106 \n at
System.ServiceModel.Dispatcher.DataContractMessagesFormatter+DataContractBodyWrit
er.WriteMessagePart (System.Xml.XmlDictionaryWriter writer,
System.ServiceModel.Description.MessageBodyDescription desc,
System.ServiceModel.Description.MessagePartDescription partDesc,
System.Object
obj) [0x00044] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Dispatcher/BaseMessagesFormatter.cs:501 \n at
System.ServiceModel.Dispatcher.DataContractMessagesFormatter+DataContractBodyWrit
er.OnWriteBodyContents (System.Xml.XmlDictionaryWriter writer) [0x00091] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Dispatcher/BaseMessagesFormatter.cs:486 \n at
System.ServiceModel.Channels.BodyWriter.WriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/BodyWriter.cs:57 \n at
System.ServiceModel.Channels.SimpleMessage.OnWriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/MessageImpl.cs:331 \n at
System.ServiceModel.Channels.Message.WriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x00022] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/Message.cs:164 \n at
System.ServiceModel.Channels.Message.WriteBody
(System.Xml.XmlDictionaryWriter writer) [0x0001c] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/Message.cs:149 \n at
System.ServiceModel.Channels.Message.OnWriteMessage
(System.Xml.XmlDictionaryWriter writer) [0x00065] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/Message.cs:274 \n at
System.ServiceModel.Channels.Message.WriteMessage
(System.Xml.XmlDictionaryWriter
writer) [0x00026] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/Message.cs:176 \n at
System.ServiceModel.Channels.TextMessageEncoder.WriteMessage
(System.ServiceModel.Channels.Message message, System.IO.Stream stream)
[0x00043]
in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/TextMessageEncoder.cs:117 \n at
System.ServiceModel.Channels.HttpRequestChannel.BeginProcessRequest
(System.ServiceModel.Channels.HttpChannelRequestAsyncResult result)
[0x00325] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/HttpRequestChannel.cs:173 \n at
System.ServiceModel.Channels.HttpRequestChannel.BeginRequest
(System.ServiceModel.Channels.Message message, TimeSpan timeout,
System.AsyncCallback callback, System.Object state) [0x00012] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/HttpRequestChannel.cs:315 \n at
System.ServiceModel.Channels.HttpRequestChannel.Request
(System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000]
in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Channels/HttpRequestChannel.cs:72 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0000b] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:582 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Description.OperationDescription od, System.Object[]
parameters) [0x00066] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:537 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess
(System.Reflection.MethodBase method, System.String operationName,
System.Object
[] parameters) [0x00038] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:502 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process
(System.Reflection.MethodBase method, System.String operationName,
System.Object
[] parameters) [0x0001c] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:479 "
Deserialize Stacktrace:
at System.Xml.Schema.XmlSchemaXPath.Read (System.Xml.Schema.XmlSchemaReader
reader, System.Xml.Schema.ValidationEventHandler h, System.String name)
[0x00076]
in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml.Schema/XmlSche
maXPath.cs:304 \n at System.Xml.Schema.XmlSchemaUnique.Read
(System.Xml.Schema.XmlSchemaReader reader,
System.Xml.Schema.ValidationEventHandler h) [0x001e7] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml.Schema/XmlSche
maUnique.cs:127 \n at System.Xml.Schema.XmlSchemaElement.Read
(System.Xml.Schema.XmlSchemaReader reader,
System.Xml.Schema.ValidationEventHandler h) [0x00563] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml.Schema/XmlSche
maElement.cs:1182 \n at System.Xml.Schema.XmlSchema.ReadContent
(System.Xml.Schema.XmlSchema schema, System.Xml.Schema.XmlSchemaReader
reader,
System.Xml.Schema.ValidationEventHandler h) [0x00280] in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml.Schema/XmlSche
ma.cs:883 \n at System.Xml.Schema.XmlSchema.Read (System.Xml.XmlReader rdr,
System.Xml.Schema.ValidationEventHandler validationEventHandler) [0x00099]
in
/home/jon/Development/xamarin/mono/mcs/class/System.XML/System.Xml.Schema/XmlSche
ma.cs:729 \n at System.Data.XmlSchemaDataImporter..ctor
(System.Data.DataSet
dataset, System.Xml.XmlReader reader, Boolean forDataSet) [0x0004b] in
/home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data/XmlSchemaDat
aImporter.cs:338 \n at System.Data.DataSet.ReadXmlSchema
(System.Xml.XmlReader
reader) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data/DataSet.cs:8
45 \n at System.Data.DataSet.ReadXml (System.Xml.XmlReader reader,
XmlReadMode
mode) [0x002cd] in
/home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data/DataSet.cs:1
018 \n at System.Data.DataSet.ReadXml (System.Xml.XmlReader reader)
[0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data/DataSet.cs:8
78 \n at System.Data.DataTable.ReadXml_internal (System.Xml.XmlReader
reader,
Boolean serializable) [0x00042] in
/home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data/DataTable.cs
:1894 \n at
System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.ReadXml
(System.Xml.XmlReader reader) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data/DataTable.cs
:1807 \n at
System.Runtime.Serialization.XmlSerializableMap.DeserializeObject
(System.Xml.XmlReader reader,
System.Runtime.Serialization.XmlFormatterDeserializer deserializer)
[0x0001a] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/SerializationMap.cs:425 \n at
System.Runtime.Serialization.XmlFormatterDeserializer.DeserializeByMap
(System.Xml.XmlQualifiedName name, System.Type type, System.Xml.XmlReader
reader)
[0x000ba] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/XmlFormatterDeserializer.cs:234 \n at
System.Runtime.Serialization.XmlFormatterDeserializer.Deserialize
(System.Type
type, System.Xml.XmlReader reader) [0x0028a] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/XmlFormatterDeserializer.cs:187 \n at
System.Runtime.Serialization.XmlFormatterDeserializer.Deserialize
(System.Xml.XmlReader reader, System.Type declaredType,
System.Runtime.Serialization.KnownTypeCollection knownTypes,
IDataContractSurrogate surrogate,
System.Runtime.Serialization.DataContractResolver resolver,
System.Runtime.Serialization.DataContractResolver defaultResolver,
System.String
name, System.String ns, Boolean verifyObjectName) [0x0007e] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/XmlFormatterDeserializer.cs:65 \n at
System.Runtime.Serialization.DataContractSerializer.ReadObject
(System.Xml.XmlDictionaryReader reader, Boolean verifyObjectName) [0x00024]
in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/DataContractSerializer.cs:344 \n at
System.Runtime.Serialization.XmlObjectSerializer.ReadObject
(System.Xml.XmlDictionaryReader reader) [0x00000] in
/home/jon/Development/xamarin/mono/mcs/class/System.Runtime.Serialization/System.
Runtime.Serialization/XmlObjectSerializer.cs:74 \n at
System.ServiceModel.Dispatcher.DataContractMessagesFormatter.ReadMessagePart
(System.ServiceModel.Description.MessagePartDescription part,
System.Xml.XmlDictionaryReader r) [0x00032] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Dispatcher/BaseMessagesFormatter.cs:436 \n at
System.ServiceModel.Dispatcher.DataContractMessagesFormatter.MessageToParts
(System.ServiceModel.Description.MessageDescription md,
System.ServiceModel.Channels.Message message) [0x000b8] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Dispatcher/BaseMessagesFormatter.cs:415 \n at
System.ServiceModel.Dispatcher.BaseMessagesFormatter.DeserializeReply
(System.ServiceModel.Channels.Message message, System.Object[] parameters)
[0x0004d] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del.Dispatcher/BaseMessagesFormatter.cs:273 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Description.OperationDescription od, System.Object[]
parameters) [0x001cb] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:572 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess
(System.Reflection.MethodBase method, System.String operationName,
System.Object
[] parameters) [0x00038] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:502 \n at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process
(System.Reflection.MethodBase method, System.String operationName,
System.Object
[] parameters) [0x0001c] in
/home/jon/Development/xamarin/mono/mcs/class/System.ServiceModel/System.ServiceMo
del/ClientRuntimeChannel.cs:479 "
--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Mono-For-Android-Unable-to-Serialise-Deserialise-Datatables-tp5462165p5462165.html
Sent from the Mono for Android mailing list archive at Nabble.com.
More information about the Monodroid
mailing list