[Mono-bugs] [Bug 60360][Nor] New - Mono allows types containing non-serializable fields to be serialized
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 17 Jun 2004 14:43:48 -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 gert.driesen@pandora.be.
http://bugzilla.ximian.com/show_bug.cgi?id=60360
--- shadow/60360 2004-06-17 14:43:48.000000000 -0400
+++ shadow/60360.tmp.10364 2004-06-17 14:43:48.000000000 -0400
@@ -0,0 +1,56 @@
+Bug#: 60360
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gert.driesen@pandora.be
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Mono allows types containing non-serializable fields to be serialized
+
+Mono currently allows types containing fields that are not serializable
+to be serialized.
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+public class EntryPoint
+{
+ public static void Main ()
+ {
+ SerializableClass instance = new SerializableClass ();
+ BinaryFormatter bf = new BinaryFormatter ();
+ MemoryStream ms = new MemoryStream ();
+ bf.Serialize (ms, instance);
+ }
+}
+
+[Serializable]
+public class SerializableClass
+{
+ // Mono should not be able to serialize this member
+ private NotSerializableClass test;
+}
+
+public class NotSerializableClass
+{
+}
+
+Running this test app on MS.NET causes the following exception to be
+thrown :
+
+Unhandled Exception: System.Runtime.Serialization.SerializationException:
+The type NotSerializableClass in Assembly test, Version=0.0.0.0,
+Culture=neutral, PublicKeyToken=null is not marked as serializable.
+
+On Mono, no exception is thrown at all.