Possible bug with [field:NonSerialized] with C++ / CLI - by SteveMargetts

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
1
Sign in
to vote
ID 227571 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 10/16/2006 2:22:28 AM
Access Restriction Public

Description

I've been working with a number of classes that expose events. These classes are marked as serializable so that they can be saved to the disk. However, I don't want the events to be serialized, as the built-in serializer will try to serialize all the subscribers to these events, and not all subscribers will be serializable (windows forms, for example). So, following the guidelines I've tagged the events of these classes with the [field:NonSerialized] attribute to prevent the subscribers to these events from being serialized. Unfortunately, this attribute appears to have no effect if the class is written in C++/CLI, although it does work for classes written in C#.
Sign in to post a comment.
Posted by Peter Ritchie on 10/16/2006 at 7:54 AM
Try breaking your event into delegate/event and applying the NonSerialized to the event handler delegate field. See http://sanity-free.org/article13.html
Posted by Peter Ritchie on 10/16/2006 at 7:54 AM
Try breaking your event into delegate/event and applying the NonSerialized to the event handler delegate field. See http://sanity-free.org/article13.html