Skip to content

Add polyfills for .NET 11 attributes. - #146

Draft
teo-tsirpanis wants to merge 3 commits into
Sergio0694:mainfrom
teo-tsirpanis:net11
Draft

teo-tsirpanis wants to merge 3 commits into
Sergio0694:mainfrom
teo-tsirpanis:net11

Conversation

@teo-tsirpanis

@teo-tsirpanis teo-tsirpanis commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

API breakdown (for new features)

Polyfills for the following attributes were added:

  • IsClosedTypeAttribute
  • RequiresUnsafeAttribute

Additional context (optional)

The list of attributes was populated by searching for the regex : .+Attribute in files matching release-notes/11.0/11.0.0/api-diff/Microsoft.NETCore.App in 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:

Also, the following runtime-supported attributes were not polyfilled:

  • ExtendedLayoutAttribute — would require polyfilling an enum, which has not been done so far

Note

I'm starting to believe that polyfilling runtime-supported attributes has not been a good idea in general.

@Sergio0694

Copy link
Copy Markdown
Owner

@teo-tsirpanis now that .NET 11 is in RC2 and the API is fixed in place, can we publish this so I can review and merge? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants