[Mono-dev] Serialization problem in WCF

Atsushi Eno atsushieno at veritas-vos-liberabit.com
Sat Aug 7 03:43:42 EDT 2010


Hello,

If you provide a complete (i.e. runnable) code example, I can try if it 
runs fine on WCF in trunk which is far better than 2.6. Or you can try 
daily snapshot by yourself.
http://mono.ximian.com/daily/

Atsushi Eno


On 2010/08/06 23:14, SuperCiccio wrote:
> I'm using Mono 2.6.7/MS .NET 3.5SP1
> I have a serialization problem trying to make Mono WCF interact with MS WCF.
>
> The service is defined as the following:
>
>      [OperationContract]
>      ServiceResult<string>  TestMethod(string varA, int varB);
>
> where ServiceResult<T>  is a generic class for returning results, so defined:
>
>      [Serializable]
>      public class ServiceResult<T>  : ServiceResult
>      {
>          public T Value { get; set; }
>      }
>
> where ServiceResult is in turn roughly
>
>      [Serializable]
>      public class ServiceResult
>      {
>          public bool Error { get; set; }
>          public List<ResultInfo>  ResultInfoList { get; set; }
>      }
>
> and so on..
>
> When talking Mono<->  Mono or MS<->  MS all goes well, but when trying to
> make them interact problems arise.
> In particular, with Mono server, when the message returns to client (the
> call terminates correctly on server) there are deserialization errors:
>
> 1) using netTcpBinding
>
> System.ServiceModel.Dispatcher.NetDispatcherFaultException: The formatter
> threw an exception while trying to deserialize the message: There was an
> error while trying to deserialize parameter
> http://tempuri.org/:TestMethodResult. The InnerException message was
> ''EndElement' 'TestMethodResult' from namespace 'http://tempuri.org/' is not
> expected. Expecting element '_x003C_Error_x003E_k__BackingField'.'.  Please
> see InnerException for more details. --->
> System.Runtime.Serialization.SerializationException: ...
>     at
> System.Runtime.Serialization.XmlObjectSerializerReadContext.ThrowRequiredMemberMissingException(XmlReaderDelegator
> xmlReader, Int32 memberIndex, Int32 requiredIndex, XmlDictionaryString[]
> memberNames)
>     at ReadServiceResultOfstringFromXml(XmlReaderDelegator ,
> XmlObjectSerializerReadContext , XmlDictionaryString[] ,
> XmlDictionaryString[] )
>     at
> System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator
> xmlReader, XmlObjectSerializerReadContext context)
>     at
> System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator
> reader, String name, String ns, DataContract&  dataContract)
>
>
> 2) using basicHttpBinding
>
> System.ServiceModel.Dispatcher.NetDispatcherFaultException: The formatter
> threw an exception while trying to deserialize the message: There was an
> error while trying to deserialize parameter
> http://tempuri.org/:TestMethodResult. The InnerException message was 'There
> was an error deserializing the object of type
> myApp.ServiceResult`1[[System.String, mscorlib, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089]]. The '<' character,
> hexadecimal value 0x3C, cannot be included in a name. Line 1, position
> 304.'.  Please see InnerException for more details. --->
> System.Runtime.Serialization.SerializationException: ... --->
> System.Xml.XmlException: ...
>     at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader
> reader, XmlException exception)
>     at System.Xml.XmlUTF8TextReader.VerifyNCName(String s)
>     at System.Xml.XmlUTF8TextReader.ReadQualifiedName(PrefixHandle prefix,
> StringHandle localName)
>     at System.Xml.XmlUTF8TextReader.ReadStartElement()
>     at System.Xml.XmlUTF8TextReader.Read()
>     at System.Runtime.Serialization.XmlReaderDelegator.Read()
>     at
> System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator
> xmlReader, XmlObjectSerializerReadContext context)
>     at
> System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator
> reader, String name, String ns, DataContract&  dataContract)
>
>
> Bugs in Mono serialization?
> Can I do anything as a workaround?
>    



More information about the Mono-devel-list mailing list