I'm serializing a Dictionary<string,string> using BinaryFormatter to a class that extends MemorySteam that I call CannotSeekStream (source below). CannotSeekStream follows the MSDN guidlines for throwing NotSupportedException from a few properties/methods.
In .net 3.5 I can serialize just fine. In 4.0, I get a NotSupportedException from the Length property. stacktrace is below. At a high level, its strange that I cannot serialize to a stream that cannot seek. Is this a bug in the
at CannotSeekStream.get_Length() at System.IO.MemoryStream.set_Capacity(Int32 value) at System.IO.MemoryStream.EnsureCapacity(Int32 value)
at System.IO.MemoryStream.WriteByte(Byte value) at System.IO.BinaryWriter.Write(Byte value) at System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Write(__BinaryWriter sout) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteSerializedStreamHeader(Int64
topId, Int64 headerId) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStrea
View Complete Post