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.Permissions
namespace:CodeAccessSecurityAttribute
DataProtectionPermission
DataProtectionPermissionAttribute
EnvironmentPermission
EnvironmentPermissionAttribute
FileDialogPermission
FileDialogPermissionAttribute
FileIOPermission
FileIOPermissionAttribute
GacIdentityPermission
GacIdentityPermissionAttribute
HostProtectionAttribute
IsolatedStorageFilePermission
IsolatedStorageFilePermissionAttribute
IsolatedStoragePermission
IsolatedStoragePermissionAttribute
KeyContainerPermission
KeyContainerPermissionAttribute
KeyContainerPermissionAccessEntry
KeyContainerPermissionAccessEntryCollection
KeyContainerPermissionAccessEntryEnumerator
MediaPermission
MediaPermissionAttribute
PermissionSetAttribute
PrincipalPermission
PrincipalPermissionAttribute
PublisherIdentityPermission
PublisherIdentityPermissionAttribute
ReflectionPermission
ReflectionPermissionAttribute
RegistryPermission
RegistryPermissionAttribute
ResourcePermissionBase
ResourcePermissionBaseEntry
SecurityAttribute
SecurityPermission
SecurityPermissionAttribute
SiteIdentityPermission
SiteIdentityPermissionAttribute
StorePermission
StorePermissionAttribute
StrongNameIdentityPermission
StrongNameIdentityPermissionAttribute
StrongNamePublicKeyBlob
TypeDescriptorPermission
TypeDescriptorPermissionAttribute
UIPermission
UIPermissionAttribute
UrlIdentityPermission
UrlIdentityPermissionAttribute
WebBrowserPermission
WebBrowserPermissionAttribute
ZoneIdentityPermission
ZoneIdentityPermissionAttribute
- Classes that derive from
CodeAccessSecurityAttribute
System.Configuration.ConfigurationPermissionAttribute
System.Data.Common.DBDataPermissionAttribute
System.Data.OracleClient.OraclePermissionAttribute
System.Diagnostics.EventLogPermissionAttribute
System.Diagnostics.PerformanceCounterPermissionAttribute
System.DirectoryServices.DirectoryServicesPermissionAttribute
System.Drawing.Printing.PrintingPermissionAttribute
System.Net.DnsPermissionAttribute
System.Net.SocketPermissionAttribute
System.Net.WebPermissionAttribute
System.Net.Mail.SmtpPermissionAttribute
System.Net.NetworkInformation.NetworkInformationPermissionAttribute
System.Net.PeerToPeer.PnrpPermissionAttribute
System.Net.PeerToPeer.Collaboration.PeerCollaborationPermissionAttribute
System.ServiceProcess.ServiceControllerPermissionAttribute
System.Transactions.DistributedTransactionPermissionAttribute
System.Web.AspNetHostingPermissionAttribute
- Interfaces:
- Classes that implement
IStackWalk
- Classes that implement
IPermission
- Classes that derive from
CodeAccessPermission
System.Configuration.ConfigurationPermission
System.Data.Common.DBDataPermission
System.Data.Odbc.OdbcPermission
System.Data.OleDb.OleDbPermission
System.Data.SqlClient.SqlClientPermission
System.Data.OracleClient.OraclePermission
System.Drawing.Printing.PrintingPermission
System.Net.DnsPermission
System.Net.SocketPermission
System.Net.WebPermission
System.Net.Mail.SmtpPermission
System.Net.NetworkInformation.NetworkInformationPermission
System.Net.PeerToPeer.PnrpPermission
System.Net.PeerToPeer.Collaboration.PeerCollaborationPermission
System.Transactions.DistributedTransactionPermission
System.Web.AspNetHostingPermission
System.Xaml.Permissions.XamlLoadPermission
- Classes that derive from
ResourcePermissionBase
- Enums in the
System.Security.Permissions
namespace:DataProtectionPermissionFlags
EnvironmentPermissionAccess
FileDialogPermissionAccess
FileIOPermissionAccess
HostProtectionResource
IsolatedStorageContainment
KeyContainerPermissionFlags
MediaPermissionAudio
MediaPermissionImage
MediaPermissionVideo
PermissionState
ReflectionPermissionFlag
RegistryPermissionAccess
SecurityAction
SecurityPermissionFlag
StorePermissionFlags
TypeDescriptorPermissionFlags
UIPermissionClipboard
UIPermissionWindow
WebBrowserPermissionLevel
- Classes/Members that depend on Code Access Security types:
System.AppDomain.PermissionSet
System.Security.HostProtectionException
System.Security.Policy.FileCodeGroup
System.Security.Policy.StrongName
System.Security.Policy.StrongNameMembershipCondition
System.Security.Policy.ApplicationTrust(PermissionSet, IEnumerable<StrongName>)
System.Security.Policy.ApplicationTrust.FullTrustAssemblies
System.Security.Policy.GacInstalled
System.Security.SecurityManager
System.Security.Policy.PolicyStatement
System.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.Publisher
System.Security.Policy.Site
System.Security.Policy.Url
System.Security.Policy.Zone
- Classes in the
SYSLIB0004
- The Constrained Execution Region (CER) feature is not supported.System.Runtime.ConstrainedExecution.PrePrepareMethodAttribute
System.Runtime.ConstrainedExecution.ReliabilityContractAttribute
System.Runtime.ConstrainedExecution.Cer
System.Runtime.ConstrainedExecution.Consistency
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup
System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions
System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegionsNoOP
System.Runtime.CompilerServices.RuntimeHelpers.PrepareContractedDelegate
System.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.Deserialize
System.Runtime.Serialization.IFormatter.Serialize
System.Runtime.Serialization.Formatters.Formatter.Deserialize
System.Runtime.Serialization.Formatters.Formatter.Serialize
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
System.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