[Mono-bugs] [Bug 46875][Min] New - Serialization allows non-serializable base class

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 24 Jul 2003 16:33:05 -0400 (EDT)


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 gonzalo@ximian.com.

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

--- shadow/46875	Thu Jul 24 16:33:05 2003
+++ shadow/46875.tmp.19398	Thu Jul 24 16:33:05 2003
@@ -0,0 +1,49 @@
+Bug#: 46875
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Serialization allows non-serializable base class 
+
+Compile and run:
+-------------
+using System;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+
+class Parent
+{
+}
+
+[Serializable]
+class Child : Parent
+{
+	static void Main ()
+	{
+		MemoryStream ms = new MemoryStream ();
+		BinaryFormatter fmt = new BinaryFormatter ();
+		Child child = new Child ();
+		fmt.Serialize (ms, child);
+		ms.Position = 0;
+		child = (Child) fmt.Deserialize (ms);
+	}
+}
+---------------
+
+Actual results:
+(nothing)
+
+Expected results:
+SerializationException: The type Parent from ser1 ..... is not marked as
+serializable.