EventInfo not serializable

  • Thread starter Thread starter Christophe Mandrillon
  • Start date Start date
C

Christophe Mandrillon

Hi all,
Some times ago, i've played with the System.Reflection namespace.
I wanted to serialize the entire structure of an object, including method,
properties, attributes and events.
I was disapointed to see that EventInfo is the only class of the inheritors
of MemberInfo that is not serializable (whereas MethodInfo, PropertyInfo,
and so on... are).
So, I would know if it's a conception mistake or if it's a requirement?
And, if it's a mistake, how can i submit a bug report to .NET framework
team, or, if it's a feature, who can explain me the justification of this
limitation?

Regards.

mandrillon_arobase_hotmail.com
Please replace the _arobase_ by @ in case of reply
 
Christophe Mandrillon said:
Hi all,
Some times ago, i've played with the System.Reflection namespace.
I wanted to serialize the entire structure of an object, including method,
properties, attributes and events.
I was disapointed to see that EventInfo is the only class of the
inheritors of MemberInfo that is not serializable (whereas MethodInfo,
PropertyInfo, and so on... are).
So, I would know if it's a conception mistake or if it's a requirement?
And, if it's a mistake, how can i submit a bug report to .NET framework
team, or, if it's a feature, who can explain me the justification of this
limitation?

Regards.

mandrillon_arobase_hotmail.com
Please replace the _arobase_ by @ in case of reply
As I understand the restriction is because an event may have subscribers.
These subscribers would need to be also serialized. When you have an event
field you need to designate such a field as non-serializable (only can be
done in a C# class).
 
As I understand the restriction is because an event may have subscribers.
These subscribers would need to be also serialized. When you have an event
field you need to designate such a field as non-serializable (only can be
done in a C# class).
I can understant this agument, but in my mind, EventInfo, as other classes
of this package store only data about the object described. If the class
publish events, the EventInfo instances only store what's the type of this
event, not the target of thos event.
The XXXInfo classes only describe the type for reflection.
In fact, I would only have a confirmation from someone of Redmont that
EventInfo is not serializable by design or by mistake...

Cheers
 
Back
Top