Skip to content

Fix AttributeUsage.AllowMultiple not inherited for C#-defined attributes#19315

Open
edgarfgp wants to merge 3 commits intodotnet:mainfrom
edgarfgp:fix-17107-allowmultiple-inherited-csharp
Open

Fix AttributeUsage.AllowMultiple not inherited for C#-defined attributes#19315
edgarfgp wants to merge 3 commits intodotnet:mainfrom
edgarfgp:fix-17107-allowmultiple-inherited-csharp

Conversation

@edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Feb 17, 2026

Description

The F# compiler was not walking the inheritance chain for IL-imported (C#) attribute types when checking AllowMultiple. The supersOfTyconRef function only used tcaug_super, which is not populated for IL types.

This fix parameterizes TryFindAttributeUsageAttribute with a getSuper resolver function. The caller in PostInferenceChecks now passes a resolver using GetSuperTypeOfType, which correctly handles both F# and IL-imported types via ILTypeDef.Extends.

Fixes #17107

Checklist

  • Test cases added
  • Release notes entry updated

…tes (dotnet#17107)

The F# compiler was not walking the inheritance chain for IL-imported
(C#) attribute types when checking AllowMultiple. The supersOfTyconRef
function only used tcaug_super, which is not populated for IL types.

This fix parameterizes TryFindAttributeUsageAttribute with a getSuper
resolver function. The caller in PostInferenceChecks now passes a
resolver using GetSuperTypeOfType, which correctly handles both F# and
IL-imported types via ILTypeDef.Extends.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/10.0.300.md

@edgarfgp edgarfgp marked this pull request as ready for review February 17, 2026 19:01
@edgarfgp edgarfgp requested a review from a team as a code owner February 17, 2026 19:01
# Conflicts:
#	docs/release-notes/.FSharp.Compiler.Service/10.0.300.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

AttributeUsage.AllowMultiple is not inherited for attributes defined (subclassed) in C#

1 participant