You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following kinds of APIs are obsolete, starting in .NET 8. Calling them in code generates warning SYSLIB0051 at compile time.
All public or protected serialization constructors that follow the pattern .ctor(SerializationInfo, StreamingContext). An example of such a constructor is Exception(SerializationInfo, StreamingContext).
DataServiceClientException inherits from InvalidOperationException and currently generates warnings because of the obsolete APIs.
We need to consider whether we really need to have the class serializable. Exception serialization is primarily intended to support remoting. Determine if that's something we really need.
The recommendation is to obsolete the serialization constructor and GetObjectData methods using the SYSLIB0051 diagnostic code - [Obsolete(DiagnosticId = "SYSLIB0051")]. Nobody is expected to be calling these APIs, obsoletion should only impact other types that subclass DataServiceClientException. It should not virally impact anybody catching, constructing, or otherwise using DataServiceClientException. Also consider removing the [Serializable] attribute. Both the built-in OData serialization logic and System.Text.Json don't depend or require the attribute.
Alternatively, we could drop the obsolete constructor and GetObjectData method from DataServiceClientException.
Below are the warning observed from the build logs:
Warning CS0672: Member 'DataServiceClientException.GetObjectData(SerializationInfo, StreamingContext)' overrides obsolete member 'Exception.GetObjectData(SerializationInfo, StreamingContext)'. Add the Obsolete attribute to 'DataServiceClientException.GetObjectData(SerializationInfo, StreamingContext)'
Warning SYSLIB0003: 'SecurityPermissionAttribute' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)
Warning SYSLIB0051: 'InvalidOperationException.InvalidOperationException(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
Warning SYSLIB0051: 'Exception.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
The text was updated successfully, but these errors were encountered:
The following kinds of APIs are obsolete, starting in .NET 8. Calling them in code generates warning SYSLIB0051 at compile time.
.ctor(SerializationInfo, StreamingContext)
. An example of such a constructor is Exception(SerializationInfo, StreamingContext).DataServiceClientException
inherits fromInvalidOperationException
and currently generates warnings because of the obsolete APIs.We need to consider whether we really need to have the class serializable. Exception serialization is primarily intended to support remoting. Determine if that's something we really need.
The recommendation is to obsolete the serialization constructor and
GetObjectData
methods using the SYSLIB0051 diagnostic code -[Obsolete(DiagnosticId = "SYSLIB0051")]
. Nobody is expected to be calling these APIs, obsoletion should only impact other types that subclassDataServiceClientException
. It should not virally impact anybody catching, constructing, or otherwise usingDataServiceClientException
. Also consider removing the[Serializable]
attribute. Both the built-in OData serialization logic and System.Text.Json don't depend or require the attribute.Alternatively, we could drop the obsolete constructor and
GetObjectData
method fromDataServiceClientException
.Below are the warning observed from the build logs:
The text was updated successfully, but these errors were encountered: