-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Meta] List of APIs considered for "Better Obsoletion" #33360
Comments
There was an issue I opened a while ago regarding Which leads me to the question: would that obsoletion also be applied to the standard, or only to .NET5? |
@Kryptos-FR The idea of .NET Standard was to unify the API surface area across multiple implementations of the .NET runtime. With .NET 5 being the unification of those to a single runtime implementation, the purpose of .NET Standard loses its meaning in that new world. As such, don't hold your breath on the Standard still evolving. |
We created dotnet/designs#139, which includes a few APIs mentioned here. |
Can I obsolete specific objects from another library (including .NET itself) in my project, if they aren't obsoleted in their source? |
You can write an analyzer. Consider forking https://github.com/dotnet/platform-compat |
@chucker is it correct if I would ever want to restrict some API usages in my project, I would need to build custom analyzer for it which I would later use for code check? |
@slavanap For code that you own, you can simply apply |
What about the case when I want to restrict usage of implicit operator, code of which I do not own? |
Note that we are working to fully productize the Here's the draft PR from @buyaa-n if you're curious; we expect the PR into dotnet/runtime will be created within the next couple weeks. @slavanap Other than including an analyzer in your package as was suggested, there isn't a way to cast |
Ha -- my goodness, I got my wires crossed on the previous comment, @slavanap, and I referenced the wrong attributes that the Platform Compat Analyzer will be using. I've fixed the comment above to be accurate. |
With the bulk of these issues now addressed, I'm going to close this issue. #46767 captured the obsoletions completed in .NET 6 and I filed #57207 to capture the remaining items from that list and this one for carrying forward into .NET 7. Thanks for originally filing this, @Joe4evr--this was a big help to steer our efforts and shape our obsoletion work. |
Rationale
Immo Landwerth (@terrajobst) has proposed a mechanism to improve obsoleting APIs by extending
ObsoleteAttribute
, affectionally known as Better Obsoletion. Recently, that proposed addition was merged into the framework and the compilers honor the new properties as of dotnet/roslyn#42518. In light of this, it seems like a good idea to gather a list of APIs that should be considered for Better Obsoletion, so there's a central place to discuss/review/suggest these.Obsolete APIs
This list is by no means exhaustive, but it'll kickstart the discussion.
The three examples from the design doc:
SecureString
- Obsolete the SecureString type #30612HttpWebRequest
(and related) - Obsolete old HTTP APIs #33125A quick search for 'obsolete' in dotnet/runtime revealed these:
Uri.EscapeUriString
- [Uri] Uri.EscapeUriString should be deprecated #31387Uri
, but doesn't specify which.Assembly.CodeBase
- Mark Assembly.CodeBase as obsolete #31127RuntimeHelpers.OffsetToStringData
- API proposal: Obsolete RuntimeHelpers.OffsetToStringData #31406(Handled in Add spec for obsoletions in .NET 5 designs#139)Thread.Abort
- Request Thread.Abort to be marked [Obsolete] #28664IAsyncResult
- Deprecate IAsyncResult #27936HandleProcessCorruptedStateExceptionsAttribute
- Consider marking HandleProcessCorruptedStateExceptionsAttribute as obsolete/hidden #31157BinaryFormatter
- Remove BinaryFormatter from the shared framework in .NET 5 #29976StringDictionary
- Mark StringDictionary as obsolete #889UTF-7 Encoding - Proposal: Obsolete UTF-7 encoding in the framework #32284(Handled in Obsolete Encoding.UTF7 property and UTF7Encoding ctors #37535)(Handled in Add spec for obsoletions in .NET 5 designs#139)PrincipalPermissionAttribute
(and related) - Non-support of PrincipalPermissionAttribute #31279Other APIs to be considered:
implicit operator DateTimeOffset(DateTime)
- Feature proposal: remove implicit construction of DateTimeOffset from DateTime #32954UnmanagedType.AnsiBStr
(and a few others) - UnmanagedType.AnsiBStr is marked as obsolete with no alternative given #31006The text was updated successfully, but these errors were encountered: