New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix S3925 FP: BinaryFormatter serialization is deprecated, should be handled differently for >= .NET 8 #8377
Comments
Other rules affected:
A list of types/members annotated as deprecated can be found here: |
@andrei-epure-sonarsource officially, this is not C#12 but .NET 8 related. |
Especially when writing custom exceptions that derive from System.Exception. |
The current implementation of S3925 requires the user to opt-in for serialization on the concrete type: sonar-dotnet/analyzers/tests/SonarAnalyzer.Test/TestCases/ImplementISerializableCorrectly.cs Lines 256 to 257 in 6d42fec
sonar-dotnet/analyzers/tests/SonarAnalyzer.Test/TestCases/ImplementISerializableCorrectly.cs Line 266 in 6d42fec
If the user opts-in, he needs to follow the old guidelines. This rule already behaves as described in the issue description and the RSpec already mentions the opt-in behavior. There is nothing to change for this rule at the moment. |
S4212 has been deprecated, so we can omit that one |
@cristian-ambrosini-sonarsource I think we looked at everything here and just forgot to close the issue, right? |
Yes, we can close this issue. |
This is a remainder from preparing for the .NET8 release.
Microsoft has been gradually dropping support for the
BinaryFormatter
, so the best practises referenced in this rule are different post-NET8.Initially raised on this community post by Corniel.
See more discussion here (internal click)
S3925 Needs specification.
Relevant information:
Expected behaviour of the rule:
ISerializable
in the base type list (it is explicitly mentioned in the current types base type list)The text was updated successfully, but these errors were encountered: