[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
https://bugzilla.novell.com/show_bug.cgi?id=635782
https://bugzilla.novell.com/show_bug.cgi?id=635782#c1
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[];
s.Close();
foreach (var item in arr)
Console.WriteLine(item);
--
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