[Mono-bugs] [Bug 80205][Wis] New - Bug in serializing a MemoryStream (due to a difference between Mono and .Net)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Dec 9 12:08:03 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by lionel_email at aulofee.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80205

--- shadow/80205	2006-12-09 12:08:03.000000000 -0500
+++ shadow/80205.tmp.13455	2006-12-09 12:08:03.000000000 -0500
@@ -0,0 +1,73 @@
+Bug#: 80205
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: lionel_email at aulofee.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Bug in serializing a MemoryStream (due to a difference between Mono and .Net)
+
+Dear All,
+
+I tried to send a serialized MemoryStream between a Windows platform
+running .Net and a Linux one running Mono (I know, sending the MemoryStream
+is strange, I should rather send the internal buffer...).
+
+And there is the bug: the way .Net and Mono serialize a MemoryStream is
+different, leading to an exception when deserializing the stream on Mono.
+More specifically, .Net uses a field called "_buffer" for its internal byte
+array, whereas Mono uses... something else I guess (sorry, I didn't take
+the time to look at Mono's sources...).
+
+Thus the exception "System.Runtime.Serialization.SerializationException:
+Field "_buffer" not found in class System.IO.MemoryStream" (see full
+details below).
+
+If I'm right on the fact Mono uses another field name, the solution would
+be simply to rename your field internally to use the same as in .NET
+'_buffer'...
+
+Cheers
+
+Lionel
+
+=======================
+The exception:
+ System.Runtime.Serialization.SerializationException: Field "_buffer" not
+found in class System.IO.MemoryStream
+  at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata
+(System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean
+hasTypeInfo) [0x00000]
+  at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance
+(System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean
+hasTypeInfo, System.Int64 objectId, System.Object value,
+System.Runtime.Serialization.SerializationInfo info) [0x00000]
+  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject
+(BinaryElement element, System.IO.BinaryReader reader, System.Int64
+objectId, System.Object value,
+System.Runtime.Serialization.SerializationInfo info) [0x00000]
+  at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject
+(System.IO.BinaryReader reader) [0x00000]
+  at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph
+(System.IO.BinaryReader reader, Boolean readHeaders, System.Object result,
+System.Runtime.Remoting.Messaging.Header[] headers) [0x00000]
+  at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize
+(System.IO.Stream serializationStream,
+System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000]
+  at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
+(System.IO.Stream serializationStream) [0x00000]


More information about the mono-bugs mailing list