Add polyfills for .NET 11 attributes. - #146
Draft
teo-tsirpanis wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Depends on the release of .NET 11 RTM.
API breakdown (for new features)
Polyfills for the following attributes were added:
IsClosedTypeAttributeRequiresUnsafeAttributeAdditional context (optional)
The list of attributes was populated by searching for the regex
: .+Attributein files matchingrelease-notes/11.0/11.0.0/api-diff/Microsoft.NETCore.Appin the branch of dotnet/core#10484, and excluding the attributes in OOB packages..NET 11 added the following properties to existing attributes that we polyfill:
namespace System.Diagnostics.CodeAnalysis { public sealed class StringSyntaxAttribute : System.Attribute { + public const string CSharp = "C#"; + public const string FSharp = "F#"; + public const string VisualBasic = "Visual Basic"; } }Following the precedent set by the .NET 10 attributes in #131, and because it would lead to an inconsistent experience, where the polyfills will be added when targeting say .NET Standard, but not a .NET version earlier than 11, these changes are not polyfilled at this moment.
The following attributes were not polyfilled:
UnionAttribute— will be added in Add polyfills for C# 15 union types (UnionAttribute and IUnion) #140MemorySafetyRulesAttribute— the compiler will synthesize it if it's missingAlso, the following runtime-supported attributes were not polyfilled:
ExtendedLayoutAttribute— would require polyfilling an enum, which has not been done so farNote
I'm starting to believe that polyfilling runtime-supported attributes has not been a good idea in general.