API obsoletions with non-default diagnostic IDs (.NET 9)
Some APIs have been marked as obsolete, starting in .NET 9. This breaking change is specific to APIs that have been marked as obsolete with a custom diagnostic ID. Suppressing the default obsoletion diagnostic ID, which is CS0618 for the C# compiler, does not suppress the warnings that the compiler generates when these APIs are used.
Change description
In previous .NET versions, these APIs can be used without any build warning. In .NET 9 and later versions, use of these APIs produces a compile-time warning or error with a custom diagnostic ID. The use of custom diagnostic IDs allows you to suppress the obsoletion warnings individually instead of blanket-suppressing all obsoletion warnings.
The following table lists the custom diagnostic IDs and their corresponding warning messages for obsoleted APIs.
Diagnostic ID | Description | Severity |
---|---|---|
SYSLIB0009 | AuthenticationManager is not supported. Methods will no-op or throw PlatformNotSupportedException. | Warning |
SYSLIB0014: WebRequest, HttpWebRequest, ServicePoint, WebClient are obsolete | ServicePointManager is fully obsolete. Settings on ServicePointManager don't affect SslStream or HttpClient (this behavior hasn't changed since .NET 6). | Warning |
SYSLIB0054 | Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write instead. | Warning |
SYSLIB0055 | AdvSimd.ShiftRightLogicalRoundedNarrowingSaturate* methods with signed parameters are obsolete. Use the unsigned overloads instead. |
Warning |
SYSLIB0056 | Assembly.LoadFrom with a custom AssemblyHashAlgorithm is obsolete. Use overloads without an AssemblyHashAlgorithm . |
Warning |
SYSLIB0057 | X509Certificate2 and X509Certificate constructors for binary and file content are obsolete. |
Warning |
Version introduced
.NET 9
Type of breaking change
These obsoletions can affect source compatibility.
Recommended action
Follow the specific guidance provided for the each diagnostic ID using the URL link provided on the warning.
Warnings or errors for these obsoletions can't be suppressed using the standard diagnostic ID for obsolete types or members; use the custom
SYSLIBxxxx
diagnostic ID value instead.
Affected APIs
SYSLIB0009
SYSLIB0014
SYSLIB0054
SYSLIB0055
- System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<Int64>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<Int16>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<Int32>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<Int16>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<Int64>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<Int32>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<SByte>, Vector128<Int16>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<Int16>, Vector128<Int32>, Byte)
- System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<Int32>, Vector128<Int64>, Byte)
SYSLIB0056
SYSLIB0057
- X509Certificate2(Byte[])
- X509Certificate2(ReadOnlySpan<Byte>)
- X509Certificate2(String)
- X509Certificate2(Byte[], SecureString)
- X509Certificate2(Byte[], String)
- X509Certificate2(String, SecureString)
- X509Certificate2(String, String)
- X509Certificate2(Byte[], SecureString, X509KeyStorageFlags)
- X509Certificate2(Byte[], String, X509KeyStorageFlags)
- X509Certificate2(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags)
- X509Certificate2(String, ReadOnlySpan<Char>, X509KeyStorageFlags)
- X509Certificate2(String, SecureString, X509KeyStorageFlags)
- X509Certificate2(String, String, X509KeyStorageFlags)
- X509Certificate(Byte[])
- X509Certificate(String)
- X509Certificate(Byte[], SecureString)
- X509Certificate(Byte[], String)
- X509Certificate(String, String, X509KeyStorageFlags)
- X509Certificate(String, SecureString)
- X509Certificate(String, String)
- X509Certificate(Byte[], SecureString, X509KeyStorageFlags)
- X509Certificate(Byte[], String, X509KeyStorageFlags)
- X509Certificate(String, SecureString, X509KeyStorageFlags)
- X509Certificate(String, String, X509KeyStorageFlags)
- Import(Byte[])
- Import(ReadOnlySpan<Byte>)
- Import(ReadOnlySpan<Byte>)
- Import(Byte[], String, X509KeyStorageFlags)
- Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags)
- Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags)
- Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags)
- Import(String, String, X509KeyStorageFlags)
- CreateFromSignedFile(String)