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.

  • 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

SYSLIB0056

SYSLIB0057

See also