[Mono-bugs] [Bug 53512][Nor] New - Binary serializer + events = null ref exception
Wed, 28 Jan 2004 21:31:27 -0500 (EST)
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 firstname.lastname@example.org.
--- shadow/53512 2004-01-28 21:31:27.000000000 -0500
+++ shadow/53512.tmp.25761 2004-01-28 21:31:27.000000000 -0500
@@ -0,0 +1,36 @@
+Product: Mono/Class Libraries
+Summary: Binary serializer + events = null ref exception
+I'm serializing a class, Data, that doesn't implement ISerializable, but is
+marked with a [Serializable] attribute. It also has two public events. The
+delegate of the event is defined in an assembly other than the one that the
+Data class is defined in.
+When I serialize a Data instance, I get a NullReferenceException in
+ObjectWriter:GetAssemblyId, because the assembly of the delegate type
+hasn't been cached with a call to RegisterAssembly. For some reason it's
+trying to serialize a field corresponding to the events: the direct cause
+is that FormatterServices.GetSerializeableMembers returns a FieldInfo
+corresponding to the event type. (It seems to me like this is wrong, since
+there's an EventInfo class, but my grasp of the underlying principles is
+So to my limited understanding, either GetSerializableMembers shouldn't
+return these FieldInfos for events (check MS implementation?) or the
+ObjectWriter should filter those fields out somehow. Or there's a genuine
+bug and events somehow need to be serialized.