Classes that implement ISerializable must be marked with Serializable attribute.
Even though a class implements ISerializable the runtime will raise a SerializationException if any of the objects in the graph are not marked Serializable. Therefore all classes that support the ISerializable interface should be marked Serializable with an attribute.
This rule violation can be automatically corrected with devAdvantage.
[C#]
public class BusinessStateObject : ISerializable
{
// Implementation
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
// TODO: Add BusinessStateObject.GetObjectData implementation
}
}
[C#]
[Serializable]
public class BusinessStateObject : ISerializable
{
// Implementation
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
// TODO: Add BusinessStateObject.GetObjectData implementation
}
}