rspec/rules/S2553/csharp/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

49 lines
1.3 KiB
Plaintext

== Why is this an issue?
The ``++ISerializable++`` interface gives you control over _how_ your class is serialized, but does not itself make the class serializable. Such classes must also have the ``++[Serializable]++`` attribute.
=== Noncompliant code example
[source,csharp]
----
public class Person : ISerializable { // Noncompliant; [Serializable] attribute missing
// ...
}
----
=== Compliant solution
[source,csharp]
----
[Serializable]
public class Person : ISerializable {
// ...
}
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
=== on 4 Feb 2015, 14:17:17 Ann Campbell wrote:
Gendarme MissingSerializableAttributeOnISerializableTypeRule
=== on 13 Apr 2015, 10:47:40 Freddy Mallet wrote:
@Tamas, does this rule makes sense to you ? Thanks
=== on 22 May 2015, 09:23:53 Tamas Vajk wrote:
\[~freddy.mallet] Yes, it makes sense. BUT it is already implemented by the Roslyn team:
https://msdn.microsoft.com/en-us/library/ms182350.aspx
https://github.com/dotnet/roslyn/blob/master/src/Diagnostics/FxCop/Core/Usage/SerializationRulesDiagnosticAnalyzer.cs
=== on 28 May 2015, 12:44:55 Tamas Vajk wrote:
This rule duplicates CA2237 (\https://msdn.microsoft.com/en-us/library/ms182350.aspx), which is already implemented by the Roslyn team.
endif::env-github,rspecator-view[]