Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec for obsoletions in .NET 5 #139

Merged
merged 14 commits into from
Jul 15, 2020
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 234 additions & 0 deletions accepted/2020/better-obsoletion/obsoletions-in-net5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# Obsoletions in .NET 5

**PM** [Immo Landwerth](https://github.com/terrajobst)

For .NET 5, [we're making](better-obsoletion.md) it more viable to obsolete APIs.
In this document, we're describing which APIs we intend to obsolete in .NET 5 and
which diagnostic IDs we will use for those.

With `dotnet/runtime` PR [#33248](https://github.com/dotnet/runtime/pull/33248),
the `ObsoleteAttribute` gained new `DiagnosticId` and `UrlFormat` properties. With
these properties, obsoletions can be grouped together when multiple APIs are
marked as obsolete for the same reason. This capability is reflected in the list
of obsoletions below. All of these obsoletions will use the `UrlFormat` of
`https://aka.ms/dotnet-warnings/{0}`.

1. The Constrained Execution Region (CER) feature is no longer implemented
* DiagnosticId: `SYSLIB0004`
* APIs:
* `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`
1. The Global Assembly Cache is no longer implemented
* DiagnosticId: `SYSLIB0005`
* APIs:
* `System.Reflection.Assembly.GlobalAssemblyCache`
1. `Thread.Abort` is no longer supported and throws PlatformNotSupportedException
* DiagnosticId: `SYSLIB0006`
* APIs:
* `System.Threading.Thread.Abort()`
* `System.Threading.Thread.Abort(Object)`
1. The default implementations of these cryptography algorithms are no longer supported and throw PlatformNotSupportedException
* DiagnosticId: `SYSLIB0007`
* APIs:
* `System.Security.Cryptography.SymmetricAlgorithm.Create()`
* `System.Security.Cryptography.AssymetricAlgorithm.Create()`
* `System.Security.Cryptography.HMAC.Create()`
* `System.Security.Cryptography.KeyedHashAlgorithm.Create()`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartonjs HashAlgorithm.Create() also throws (and there's a unit test including it in the same list as these others). Should we obsolete it as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HashAlgorithm.Create() also throws (and there's a unit test including it in the same list as these others). Should we obsolete it as well?

Yep.

1. The CreatePdbGenerator API is no longer supported and throws PlatformNotSupportedException
* DiagnosticId: `SYSLIB0008`
* APIs:
* `System.Runtime.CompilerServices.DebugInfoGenerator.CreatePdbGenerator`
1. The AuthenticationManager Authenticate and PreAuthenticate APIs are no longer supported and throw PlatformNotSupportedException
* DiagnosticId: `SYSLIB0009`
* APIs:
* `System.Net.AuthenticationManager.Authenticate`
* `System.Net.AuthenticationManager.PreAuthenticate`
1. These Remoting APIs are no longer supported and throw PlatformNotSupportedException
* DiagnosticId: `SYSLIB0010`
* APIs:
* `System.MarshalByRefObject.GetLifetimeService`
* `System.MarshalByRefObject.InitializeLifetimeService`
1. Code Access Security (CAS) APIs are no longer supported
* DiagnosticId: `SYSLIB0002` (reusing the existing DiagnosticId from `PrincipalPermissionAttribute`)
* APIs:
* Classes: (everything from 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`
* `MediaPermission`
* `MediaPermissionAttribute`
* `PermissionSetAttribute`
* `PrincipalPermission`
* `PrincipalPermissionAttribute` (already has the attribute)
* `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.IdentityModel.Services.ClaimsPrincipalPermissionAttribute`
* `System.Messaging.MessageQueuePermissionAttribute`
* `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.Security.Permissions.DataProtectionPermissionAttribute`
* `System.Security.Permissions.EnvironmentPermissionAttribute`
* `System.Security.Permissions.FileDialogPermissionAttribute`
* `System.Security.Permissions.FileIOPermissionAttribute`
* `System.Security.Permissions.GacIdentityPermissionAttribute`
* `System.Security.Permissions.HostProtectionAttribute`
* `System.Security.Permissions.IsolatedStoragePermissionAttribute`
* `System.Security.Permissions.KeyContainerPermissionAttribute`
* `System.Security.Permissions.MediaPermissionAttribute`
* `System.Security.Permissions.PermissionSetAttribute`
* `System.Security.Permissions.PrincipalPermissionAttribute`
* `System.Security.Permissions.PublisherIdentityPermissionAttribute`
* `System.Security.Permissions.ReflectionPermissionAttribute`
* `System.Security.Permissions.RegistryPermissionAttribute`
* `System.Security.Permissions.SecurityPermissionAttribute`
* `System.Security.Permissions.SiteIdentityPermissionAttribute`
* `System.Security.Permissions.StorePermissionAttribute`
* `System.Security.Permissions.StrongNameIdentityPermissionAttribute`
* `System.Security.Permissions.TypeDescriptorPermissionAttribute`
* `System.Security.Permissions.UIPermissionAttribute`
* `System.Security.Permissions.UrlIdentityPermissionAttribute`
* `System.Security.Permissions.WebBrowserPermissionAttribute`
* `System.Security.Permissions.ZoneIdentityPermissionAttribute`
* `System.ServiceProcess.ServiceControllerPermissionAttribute`
* `System.Transactions.DistributedTransactionPermissionAttribute`
* `System.Web.AspNetHostingPermissionAttribute`
* Interfaces:
* `System.Security.PermissionsIUnrestrictedPermission`
* `System.Security.IPermission`
* `System.Security.IStackWalk`
* Classes that implement `IStackWalk`
* `System.Security.PermissionSet`
* `System.Security.NamedPermissionSet`
* `System.Security.ReadOnlyPermissionSet`
* Classes that implement `IPermission`
* `System.IdentityModel.Services.ClaimsPrincipalPermission`
* `System.Security.CodeAccessPermission`
* Classes that derive from `CodeAccessPermission` (also includes implementations of `PermissionsIUnrestrictedPermission`)
* `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.Messaging.MessageQueuePermission`
* `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`
* `System.Diagnostics.EventLogPermission`
* `System.Diagnostics.PerformanceCounterPermission`
* `System.DirectoryServices.DirectoryServicesPermission`
* `System.ServiceProcess.ServiceControllerPermission`
* Enums: (everything from the `System.Security.Permissions` namespace)
* `DataProtectionPermissionFlags`
* `EnvironmentPermissionAccess`
* `FileDialogPermissionAccess`
* `FileIOPermissionAccess`
* `HostProtectionResource`
* `IsolatedStorageContainment`
* `KeyContainerPermissionFlags`
* `MediaPermissionAudio`
* `MediaPermissionImage`
* `MediaPermissionVideo`
* `PermissionState`
* `ReflectionPermissionFlag`
* `RegistryPermissionAccess`
* `SecurityAction` (with removal of the existing attributes on members)
* `SecurityPermissionFlag`
* `StorePermissionFlags`
* `TypeDescriptorPermissionFlags`
* `UIPermissionClipboard`
* `UIPermissionWindow`
* `WebBrowserPermissionLevel`

## Other Considerations

Several other APIs were considered for obsoletion in .NET 5, but we chose to focus
on groupings of APIs that categorically do not work in .NET 5. This strategy optimizes
for projects migrating from .NET Framework while keeping the risk of negative disruption
relatively low.

Some specific APIs had already been suggested for obsoletion. We reviewed those suggestions
during this consideration as well. For example, [`SecureString`](https://github.com/dotnet/runtime/issues/30612)
was considered but we chose to omit it for now. We are aware of some notable usage of
`SecureString` where marking it as obsolete would cause disruption, and we do not yet
have a clear alternative approach to recommend.

Obsoleting the set of APIs above will still provide enough usage of the new obsoletion
behavior that we can collect feedback from users and determine how aggressively we can
obsolete more APIs in .NET 6.

We would also like to thank @Joe4evr for helping kickstart the conversation with
[#33360](https://github.com/dotnet/runtime/issues/33360). That issue will remain open
and we will continue consider the APIs noted there in future releases.