CancelEventArgs is not marked Serializable  
Author Message
tcreevan





PostPosted: .NET Remoting and Runtime Serialization, CancelEventArgs is not marked Serializable Top

The System.ComponentModel.CancelEventArgs class in the .Net Framework 2.0 is not marked with the Serializable attribute. I discovered this in a remoting application that I am working on when the app through a SerializationException.

Why is the System.ComponentModel.CancelEventArgs class not marked as Serializable

Is this a bug or oversight in the .Net Framework 2.0



.NET Development1  
 
 
Sean Hederman





PostPosted: .NET Remoting and Runtime Serialization, CancelEventArgs is not marked Serializable Top

I don't think so. CancelEventArgs (and HandledEventArgs) are both modifiable, unlike most EventArgs, and neither are Serializable. This commonality is a hint, so I think that they are worried about people using modifiable event arguments across Remoting. I can see why, as it could get pretty difficult deciding what happens when sending such an event across the network whilst at the same time also having it going to local event handlers.



 
 
tcreevan





PostPosted: .NET Remoting and Runtime Serialization, CancelEventArgs is not marked Serializable Top

Thanks for your reply. Yours is a good point. Let's see what others have to say.

It's simple enough to recreate the class but I am wondering if that would be a mistake.