Skip to content

Features marked as Obsolete in .NET 5.0 with custom diagnostics #20894

Closed
@jeffhandley

Description

@jeffhandley

Features marked as Obsolete in .NET 5.0

For .NET 5.0, we've made it more viable to mark APIs as obsolete by extending ObsoleteAttribute to include optional DiagnosticId and UrlFormat properties. These properties are respected by the compiler to generate build warnings using a custom diagnostic and to include a URL link to a documentation page for learning more about the obsoletion. This behavior allows for obsoletion warning to be suppressed specifically and separately from one another using the custom diagnostic id values.

Using this improved obsoletion mechanism, .NET 5.0 marks several features as obsolete using custom diagnostics.

If build warnings or errors are encountered due to usage of these obsolete APIs, follow the specific guidance provided for the different diagnostics using the URL link provided on the warning. Warnings or errors for these obsoletions cannot be suppressed using the standard diagnostic id for obsolete types or members; the custom SYSLIB#### diagnostic id values must be used instead.

Version introduced

.NET 5.0

Old behavior

These APIs could be referenced without any build warnings.

New behavior

References to these APIs will produce build warnings with the corresponding diagnostics.

Reason for change

These APIs were marked as obsolete for a different reasons.

Diagnostic ID Description
SYSLIB0001 The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.
SYSLIB0002 PrincipalPermissionAttribute is not honored by the runtime and must not be used.
SYSLIB0003 Code Access Security is not supported or honored by the runtime.
SYSLIB0004 The Constrained Execution Region (CER) feature is not supported.
SYSLIB0005 The Global Assembly Cache is not supported.
SYSLIB0006 Thread.Abort is not supported and throws PlatformNotSupportedException.
SYSLIB0007 The default implementation of this cryptography algorithm is not supported.
SYSLIB0008 The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException.
SYSLIB0009 The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.
SYSLIB0010 This Remoting API is not supported and throws PlatformNotSupportedException.
SYSLIB0011 BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for recommended alternatives.
SYSLIB0012 Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.

Recommended action

Category

  • ASP.NET Core
  • C#
  • Code analysis
  • Core .NET libraries
  • Cryptography
  • Data
  • Debugger
  • Deployment
  • Globalization
  • Interop
  • JIT
  • LINQ
  • Managed Extensibility Framework (MEF)
  • MSBuild
  • Networking
  • Printing
  • Security
  • Serialization
  • Visual Basic
  • Windows Forms
  • Windows Presentation Foundation (WPF)
  • XML, XSLT

Affected APIs


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 5Work items for the .NET 5 releasebreaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions