-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
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
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. This obsoletion produces a build error.SYSLIB0003- Code Access Security is not supported or honored by the runtime.- Classes in the
System.Security.Permissionsnamespace:CodeAccessSecurityAttributeDataProtectionPermissionDataProtectionPermissionAttributeEnvironmentPermissionEnvironmentPermissionAttributeFileDialogPermissionFileDialogPermissionAttributeFileIOPermissionFileIOPermissionAttributeGacIdentityPermissionGacIdentityPermissionAttributeHostProtectionAttributeIsolatedStorageFilePermissionIsolatedStorageFilePermissionAttributeIsolatedStoragePermissionIsolatedStoragePermissionAttributeKeyContainerPermissionKeyContainerPermissionAttributeKeyContainerPermissionAccessEntryKeyContainerPermissionAccessEntryCollectionKeyContainerPermissionAccessEntryEnumeratorMediaPermissionMediaPermissionAttributePermissionSetAttributePrincipalPermissionPrincipalPermissionAttributePublisherIdentityPermissionPublisherIdentityPermissionAttributeReflectionPermissionReflectionPermissionAttributeRegistryPermissionRegistryPermissionAttributeResourcePermissionBaseResourcePermissionBaseEntrySecurityAttributeSecurityPermissionSecurityPermissionAttributeSiteIdentityPermissionSiteIdentityPermissionAttributeStorePermissionStorePermissionAttributeStrongNameIdentityPermissionStrongNameIdentityPermissionAttributeStrongNamePublicKeyBlobTypeDescriptorPermissionTypeDescriptorPermissionAttributeUIPermissionUIPermissionAttributeUrlIdentityPermissionUrlIdentityPermissionAttributeWebBrowserPermissionWebBrowserPermissionAttributeZoneIdentityPermissionZoneIdentityPermissionAttribute
- Classes that derive from
CodeAccessSecurityAttributeSystem.Configuration.ConfigurationPermissionAttributeSystem.Data.Common.DBDataPermissionAttributeSystem.Data.OracleClient.OraclePermissionAttributeSystem.Diagnostics.EventLogPermissionAttributeSystem.Diagnostics.PerformanceCounterPermissionAttributeSystem.DirectoryServices.DirectoryServicesPermissionAttributeSystem.Drawing.Printing.PrintingPermissionAttributeSystem.Net.DnsPermissionAttributeSystem.Net.SocketPermissionAttributeSystem.Net.WebPermissionAttributeSystem.Net.Mail.SmtpPermissionAttributeSystem.Net.NetworkInformation.NetworkInformationPermissionAttributeSystem.Net.PeerToPeer.PnrpPermissionAttributeSystem.Net.PeerToPeer.Collaboration.PeerCollaborationPermissionAttributeSystem.ServiceProcess.ServiceControllerPermissionAttributeSystem.Transactions.DistributedTransactionPermissionAttributeSystem.Web.AspNetHostingPermissionAttribute
- Interfaces:
- Classes that implement
IStackWalk - Classes that implement
IPermission - Classes that derive from
CodeAccessPermissionSystem.Configuration.ConfigurationPermissionSystem.Data.Common.DBDataPermissionSystem.Data.Odbc.OdbcPermissionSystem.Data.OleDb.OleDbPermissionSystem.Data.SqlClient.SqlClientPermissionSystem.Data.OracleClient.OraclePermissionSystem.Drawing.Printing.PrintingPermissionSystem.Net.DnsPermissionSystem.Net.SocketPermissionSystem.Net.WebPermissionSystem.Net.Mail.SmtpPermissionSystem.Net.NetworkInformation.NetworkInformationPermissionSystem.Net.PeerToPeer.PnrpPermissionSystem.Net.PeerToPeer.Collaboration.PeerCollaborationPermissionSystem.Transactions.DistributedTransactionPermissionSystem.Web.AspNetHostingPermissionSystem.Xaml.Permissions.XamlLoadPermission
- Classes that derive from
ResourcePermissionBase - Enums in the
System.Security.Permissionsnamespace:DataProtectionPermissionFlagsEnvironmentPermissionAccessFileDialogPermissionAccessFileIOPermissionAccessHostProtectionResourceIsolatedStorageContainmentKeyContainerPermissionFlagsMediaPermissionAudioMediaPermissionImageMediaPermissionVideoPermissionStateReflectionPermissionFlagRegistryPermissionAccessSecurityActionSecurityPermissionFlagStorePermissionFlagsTypeDescriptorPermissionFlagsUIPermissionClipboardUIPermissionWindowWebBrowserPermissionLevel
- Classes/Members that depend on Code Access Security types:
System.AppDomain.PermissionSetSystem.Security.HostProtectionExceptionSystem.Security.Policy.FileCodeGroupSystem.Security.Policy.StrongNameSystem.Security.Policy.StrongNameMembershipConditionSystem.Security.Policy.ApplicationTrust(PermissionSet, IEnumerable<StrongName>)System.Security.Policy.ApplicationTrust.FullTrustAssembliesSystem.Security.Policy.GacInstalledSystem.Security.SecurityManagerSystem.Security.Policy.PolicyStatementSystem.Security.Policy.PolicyLevel.AddNamedPermissionSet(NamedPermissionSet)System.Security.Policy.PolicyLevel.ChangeNamedPermissionSet(string, PermissionSet)System.Security.Policy.PolicyLevel.GetNamedPermissionSet(string)System.Security.Policy.PolicyLevel.RemoveNamedPermissionSet(NamedPermissionSet)System.Security.Policy.PolicyLevel.RemoveNamedPermissionSet(string)System.Security.Policy.PublisherSystem.Security.Policy.SiteSystem.Security.Policy.UrlSystem.Security.Policy.Zone
- Classes in the
SYSLIB0004- The Constrained Execution Region (CER) feature is not supported.System.Runtime.ConstrainedExecution.PrePrepareMethodAttributeSystem.Runtime.ConstrainedExecution.ReliabilityContractAttributeSystem.Runtime.ConstrainedExecution.CerSystem.Runtime.ConstrainedExecution.ConsistencySystem.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanupSystem.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegionsSystem.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegionsNoOPSystem.Runtime.CompilerServices.RuntimeHelpers.PrepareContractedDelegateSystem.Runtime.CompilerServices.RuntimeHelpers.ProbeForSufficientStack
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.System.Runtime.Serialization.IFormatter.DeserializeSystem.Runtime.Serialization.IFormatter.SerializeSystem.Runtime.Serialization.Formatters.Formatter.DeserializeSystem.Runtime.Serialization.Formatters.Formatter.SerializeSystem.Runtime.Serialization.Formatters.Binary.BinaryFormatter.DeserializeSystem.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
SYSLIB0012- Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.
Issue metadata
- Issue type: breaking-change