[Mono-bugs] [Bug 635782] Serialization / De-serialization

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 3 08:19:29 EDT 2010



Mika Aalto <mika.aalto at tut.fi> changed:

           What    |Removed                     |Added
                 CC|                            |mika.aalto at tut.fi

--- Comment #1 from Mika Aalto <mika.aalto at tut.fi> 2010-10-03 12:19:27 UTC ---
Given example fails also with MS .NET but exception type and error message are
different. MS .NET throws SerializationException with message "End of Stream
encountered before parsing was completed.".

You can get your code working if you reset memory stream position before
deserializing like this:

Stream s = new MemoryStream();
int[] arr = new int[] { 1, 2, 3 };
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(s, arr);
s.Position = 0;
arr = formatter.Deserialize(s) as int[];
foreach (var item in arr)

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list