locked
Sync Image-column to device sqlCE fails RRS feed

  • Question

  • Hi,

    I'm trying to set up a N-tier sync between SqlServer 2008r2 and windows mobile 6.5 devices using sqlCE, with a WCF in the middle.

    After som initial troubles i have managed to solve most problems. However now i'm stuck on this one: if i try to sync a table containing a column of type Image an exception is thrown on the device while processing the response from the WCF. It seems to fail consuming the XML. If i remove this column the sync works without problem. Seems to be the same problem as: http://social.microsoft.com/Forums/sv/syncdevdiscussions/thread/0350c3ef-19fe-45f6-ae43-e6c21315813c .

    Is there anyway to fix this without changing my schema?

    Stack Trace:

       at System.Convert.FromBase64CharArrayHelper(Char* pCharArray, Int32 offset, Int32 length)
       at System.Convert.FromBase64String(String s)
       at System.Data.Common.ObjectStorage.ConvertXmlToObject(String s)
       at System.Data.DataColumn.ConvertXmlToObject(String s)
       at System.Data.XmlDataLoader.LoadColumn(DataColumn column, Object[] foundColumns)
       at System.Data.XmlDataLoader.LoadTable(DataTable table, Boolean isNested)
       at System.Data.XmlDataLoader.LoadData(XmlReader reader)
       at System.Data.DataSet.ReadXmlDiffgram(XmlReader reader)
       at System.Data.DataSet.ReadXml(XmlReader reader, XmlReadMode mode, Boolean denyResolving)
       at System.Data.DataSet.ReadXmlSerializable(XmlReader reader)
       at System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)
       at System.Xml.Serialization.XmlSerializationReader.DeserializeSerializableElement(LogicalType deserializeAs, Accessor accessor, Fixup fixup, Object fixupTarget, String identifier, Boolean emptyValue, Boolean nullValue)
       at System.Xml.Serialization.XmlSerializationReader.deserializeElement(Accessor accessor, Fixup fixup, Object fixupTarget)
       at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember(MemberValueCollection members, Object fixupTarget, Hashtable internalState, Boolean& firstElement)
       at System.Xml.Serialization.XmlSerializationReader.deserializeMembers(MemberValueCollection members, Object fixupTarget)
       at System.Xml.Serialization.XmlSerializationReader.DeserializeComplexElement(LogicalType deserializeAs, Accessor accessor, Fixup fixup, Object fixupTarget, String identifier, Boolean emptyValue, Boolean nullValue)
       at System.Xml.Serialization.XmlSerializationReader.deserializeElement(Accessor accessor, Fixup fixup, Object fixupTarget)
       at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember(MemberValueCollection members, Object fixupTarget, Hashtable internalState, Boolean& firstElement)
       at System.Xml.Serialization.XmlSerializationReader.deserializeMembers(MemberValueCollection members, Object fixupTarget)
       at System.Xml.Serialization.XmlSerializationReader.DeserializeComplexElement(LogicalType deserializeAs, Accessor accessor, Fixup fixup, Object fixupTarget, String identifier, Boolean emptyValue, Boolean nullValue)
       at System.Xml.Serialization.XmlSerializationReader.deserializeElement(Accessor accessor, Fixup fixup, Object fixupTarget)
       at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember(MemberValueCollection members, Object fixupTarget, Hashtable internalState, Boolean& firstElement)
       at System.Xml.Serialization.XmlSerializationReader.deserializeMembers(MemberValueCollection members, Object fixupTarget)
       at System.Web.Services.Protocols.SoapMessageParser.execute()
       at System.Web.Services.Protocols.SoapMessageSerializer.Deserialize(XmlReader reader, SoapHttpClientProtocol client, LogicalSoapMethod soapMethod, Boolean soap12)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at Comit.WindowsCE.GateGuard.DataSync.SivanSyncService.SivanSyncService.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
       at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
       at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
       at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
       at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
       at Microsoft.Synchronization.SyncAgent.Synchronize()

    EDIT:

    I Re-read the link provided above and saw his conclusion about the '0x' fields being the culprit. And I noticed there were rows with that value in my table as well. After replacing them with NULL the sync worked without problem. I think this might be an acceptable way to deal with it...

    • Edited by __Henrik Wednesday, January 16, 2013 9:55 AM new details
    Tuesday, January 15, 2013 3:39 PM