Rediger

Del via


SYSLIB0058: Certain SslStream properties are obsolete

The following properties of System.Net.Security.SslStream are obsolete, starting in .NET 10:

ExchangeAlgorithmType, CipherAlgorithmType, and HashAlgorithmType enums are obsolete since they were only used by the SslStream class.

Reason for obsoletion

The obsoleted enum types were outdated and missing members for covering new algorithms. Since the same information is available via System.Net.Security.SslStream.NegotiatedCipherSuite, the outdated properties were removed to clarify which one should be used for logging/auditing purposes.

Workaround

Use System.Net.Security.SslStream.NegotiatedCipherSuite instead.

Suppress a warning

If you must use the obsolete API, you can suppress the warning in code or in your project file.

To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.

// Disable the warning.
#pragma warning disable SYSLIB0058

// Code that uses obsolete API.
// ...

// Re-enable the warning.
#pragma warning restore SYSLIB0058

To suppress all the SYSLIB0058 warnings in your project, add a <NoWarn> property to your project file.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
   ...
   <NoWarn>$(NoWarn);SYSLIB0058</NoWarn>
  </PropertyGroup>
</Project>

For more information, see Suppress warnings.