Bug 5454 - Can't serialize a MemoryStream
Summary: Can't serialize a MemoryStream
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-06-01 08:58 UTC by Gary____
Modified: 2012-06-07 09:27 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Gary____ 2012-06-01 08:58:04 UTC
As discussed with Alan serialization of MemoryStream fails with error: 

System.Runtime.Serialization.SerializationException: Type System.Threading.AutoResetEvent is not marked as Serializable.
  at System.Runtime.Serialization.Formatters.Binary.BinaryCommon.CheckSerializable (System.Type type, ISurrogateSelector selector, StreamingContext context) [0x0002c] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs:119
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteValue (System.IO.BinaryWriter writer, System.Type valueType, System.Object val) [0x00006] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:762
  at MemoryStream__TypeMetadata.WriteObjectData (System.Runtime.Serialization.Formatters.Binary.ObjectWriter , System.IO.BinaryWriter , System.Object ) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x0011e] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:370
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00062] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:303
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00005] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:281
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x0001f] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:268
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x0005f] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:226
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in /home/garyb/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:205
  at ResxTryOuts.MainClass.Main (System.String[] args) [0x000de] in /home/garyb/MDProjects/ResxTryOuts/ResxTryOuts/Main.cs:36
Comment 1 Marek Safar 2012-06-07 09:27:34 UTC
Fixed in master