Skip to content

Conversation

@teo-tsirpanis
Copy link
Contributor

@teo-tsirpanis teo-tsirpanis commented Aug 25, 2025

Note

Depends on #127.

API breakdown (for new features)

Polyfills for the following attributes were added:

  • [CompilerLoweringPreserve]
    • Also applied to the polyfill for DynamicallyAccessedMembersAttribute, matching upstream.
  • [ExtensionMarker]
  • The DynamicDependencyAttrribute.Condition property in the polyfill was obsoleted and hidden, matching upstream.

Polyfills for the following runtime-supported attributes were added:

  • [UnsafeAccessorType]

Additional context (optional)

The list of attributes was populated by searching for the regex : .+Attribute in files matching release-notes/10.0/api-diff/Microsoft.NETCore.App in the branch of dotnet/core#10147, and excluding the attributes in OOB packages.

.NET 10 added the following properties to existing attributes that we polyfill:

namespace System.Diagnostics.CodeAnalysis
{
    public sealed class ExperimentalAttribute : System.Attribute
    {
+       public string? Message { get; set; }
    }
    public sealed class RequiresDynamicCodeAttribute : System.Attribute
    {
+       public bool ExcludeStatics { get; set; }
    }
    public sealed class RequiresUnreferencedCodeAttribute : System.Attribute
    {
+       public bool ExcludeStatics { get; set; }
    }
}

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 10, these changes are not polyfilled at this moment.

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

  • TypeMapAssemblyTargetAttribute<TTypeGroup>, TypeMapAssociationAttribute<TTypeGroup>, and TypeMapAttribute<TTypeGroup>, because they are generic and would cause issues on downlevel runtimes.
  • MetadataUpdateDeletedAttribute, because it is emitted by Hot Reload, and applying it manually is not allowed.

@teo-tsirpanis
Copy link
Contributor Author

PR description updated for .NET 10 RTM's release; no new useful attributes were added since. This is ready for review.

@teo-tsirpanis teo-tsirpanis marked this pull request as ready for review November 22, 2025 19:06
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.

1 participant