rspec/rules/S3927/description.adoc

15 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-07-04 15:32:38 +02:00
== Why is this an issue?
Serialization event handlers that don't have the correct signature will not be called, bypassing augmentations to automated serialization and deserialization events.
2023-07-04 15:32:38 +02:00
A method is designated a serialization event handler by applying one of the following serialization event attributes:
* https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.onserializingattribute[`OnSerializingAttribute`]
* https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.onserializedattribute[`OnSerializedAttribute`]
* https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.ondeserializingattribute[`OnDeserializingAttribute`]
* https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.ondeserializedattribute[`OnDeserializedAttribute`]
2023-07-04 15:32:38 +02:00
Serialization event handlers take a single parameter of type https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.streamingcontext[`StreamingContext`], return `void`, and have `private` visibility.
2023-07-04 15:32:38 +02:00
This rule raises an issue when any of these constraints are not respected.