[Mono-bugs] [Bug 78593][Nor] Changed - Serialization formatters don't throw on missing fields

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Aug 25 05:39:25 EDT 2007


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 robertj at gmx.net.

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

--- shadow/78593	2007-04-27 05:17:15.000000000 -0400
+++ shadow/78593.tmp.6679	2007-08-25 05:39:25.000000000 -0400
@@ -88,6 +88,53 @@
 #78747)
 
 ------- Additional Comments From robertj at gmx.net  2006-07-03 16:46 -------
 Yes, I know. In fact I discovered the bug while implementing
 OptionalFieldAttribute.
 
+
+------- Additional Comments From robertj at gmx.net  2007-08-25 05:39 -------
+Another closely related bug: When a field has been removed from
+a class, the deserializer will throw an exception when it
+tries to deserialize historical data.
+
+MS.NET (both profiles) accepts this data.
+
+
+mcs test.cs
+mono test.exe
+
+mcs /d:EVOLUTION test.cs
+mono test.exe
+
+
+---
+using System;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+
+[Serializable]
+class Test
+{
+#if !EVOLUTION
+	int value1;
+#endif
+
+	static void Main ()
+	{
+		BinaryFormatter bf = new BinaryFormatter ();
+
+#if EVOLUTION
+		using (FileStream stm = File.OpenRead ("serializationdata")) {
+			Test t = (Test) bf.Deserialize (stm);
+			Console.WriteLine (t);
+		}
+#else
+		Test t = new Test ();
+		using (FileStream stm = File.Create ("serializationdata")) {
+			bf.Serialize (stm, t);
+		}
+#endif
+	}
+}
+---
+


More information about the mono-bugs mailing list