[Mono-dev] Remoting serialization problem with array of arrays

Jae Stutzman jaebird at gmail.com
Mon Aug 6 12:07:20 EDT 2007


We are passing array of array of our custom object (ie not framework) as a
parameter to remote methods. This works fine between to .NET boxes or if the
server is running on mono (linux), but fails if one of the server is running
on windows and client on mono (linux). We are actually using interfaces, but
the behavior is the same.

Example:

Client:
HappyHello[][] hello = ....
testRemoteMethod.Hello(hello);

The exception that is returned is a rethrown exception (coming from the
server) as a serialization error:

  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetAssemblyNameId(
System.String assembly) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetAssemblyId (
System.Reflection.Assembly assembly) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteTypeSpec (
System.IO.BinaryWriter writer, System.Type type) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteGenericArray(
System.IO.BinaryWriter writer, Int64 id, System.Array array) [0x00000]
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(
System.IO.BinaryWriter writer, Int64 id, System.Array array) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance(
System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject)
[0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects(
System.IO.BinaryWriter writer) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph(
System.IO.BinaryWriter writer, System.Object obj,
System.Runtime.Remoting.Messaging.Header[] headers) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.MessageFormatter.WriteMethodCall(
System.IO.BinaryWriter writer, System.Object obj,
System.Runtime.Remoting.Messaging.Header[] headers, ISurrogateSelector
surrogateSelector, StreamingContext context, FormatterAssemblyStyle
assemblyFormat, FormatterTypeStyle typeFormat) [0x00000]
  at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (
System.IO.Stream serializationStream, System.Object graph,
System.Runtime.Remoting.Messaging.Header[] headers) [0x00000]
  at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg) [0x00000]

This is what I think is happening: The client is not serializing the
object[][] properly which causes the server to throw the exception. Like I
mentioned above, if the server is running on mono, the windows client
serializes properly and the server does not throw and error. Also, if I
change it to only be one array of HappyHello, the code works fine on both
platforms.

I hope this is clear... I can write a bug for this.

Cheers,

Jae
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070806/d11d2530/attachment.html 


More information about the Mono-devel-list mailing list