-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Serialization.UseCorrectSignatureForSerializationMethodsRule(2.10)
Sebastien Pouliot edited this page Feb 9, 2011
·
3 revisions
Assembly: Gendarme.Rules.Serialization
Version: 2.10
This rule checks for methods which use the serialization attributes: OnSerializing, OnDeserializing, OnSerialized, OnDeserialized. You must ensure that these methods have the correct signature. They should be private, return void and have a single parameter of type StreamingContext. Failure to have the right signature can, in some circumstances, make your assembly unusable at runtime.
Bad example:
[Serializable]
public class Bad {
[OnSerializing]
public bool Serializing (StreamingContext context)
{
}
}
Good example:
[Serializable]
public class BadClass {
[OnSerializing]
private void Serializing (StreamingContext context)
{
}
}
- This rule is available since Gendarme 2.0
Note that this page was autogenerated (3/17/2011 9:31:58 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!