从 .NET 10 开始,System.Net.Security.SslStream 的以下属性已过时:
ExchangeAlgorithmType、CipherAlgorithmType和 HashAlgorithmType 枚举已过时,因为它们仅由 SslStream 类使用。
过时的原因
过时的枚举类型已过时,缺少用于涵盖新算法的成员。 由于通过 System.Net.Security.SslStream.NegotiatedCipherSuite提供了相同的信息,因此删除了过时的属性,以澄清哪些属性应用于日志记录/审核目的。
解决方法
请改用 System.Net.Security.SslStream.NegotiatedCipherSuite。
禁止显示警告
如果必须使用过时的 API,可以在代码或项目文件中禁止显示警告。
若要仅取消单个冲突,请将预处理器指令添加到源文件以禁用,然后重新启用警告。
// Disable the warning.
#pragma warning disable SYSLIB0058
// Code that uses obsolete API.
// ...
// Re-enable the warning.
#pragma warning restore SYSLIB0058
若要取消项目中的所有 SYSLIB0058
警告,请将 <NoWarn>
属性添加到项目文件。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<NoWarn>$(NoWarn);SYSLIB0058</NoWarn>
</PropertyGroup>
</Project>
有关详细信息,请参阅 禁止显示警告。