.NET 8 S3925 vs SYSLIB0051 - This API supports obsolete formatter-based serialization

We have a lot of custom exceptions that derive from System.Exception or other .NET related exceptions.
So far, we always implemented ISerializable and the required methods to conform S3925:

Since .NET 8, there is a conflict with SYSLIB0051:
Exception.Exception(SerializationInfo, StreamingContext)ā€™ is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code

At the moment we deactivated the rule S3925.

Any ideas how Sonar will handle this issue or what would be the best way to deal with this?

Thanks!
Dominik

Hey there.

I think this will get handled in SonarSource/sonar-dotnet #8377 ā€“ can you have a look and make sure I know what Iā€™m talking about?

Looks like it - I added my comment about the Exceptions to the Github issue!

1 Like