Skip to content

Preserve allows ref struct constraints in GenAPI#54456

Merged
ViktorHofer merged 1 commit into
fix-genapi-notnull-constraintsfrom
fix-genapi-allows-ref-struct
May 27, 2026
Merged

Preserve allows ref struct constraints in GenAPI#54456
ViktorHofer merged 1 commit into
fix-genapi-notnull-constraintsfrom
fix-genapi-allows-ref-struct

Conversation

@ViktorHofer

Copy link
Copy Markdown
Member

Fixes #47113.

Stacked on #54455.

Summary

  • Preserve allows ref struct generic constraints when GenAPI generates C# declarations from metadata.
  • Keep allows ref struct last in the generated constraint list, including when combined with notnull.
  • Cover method, type, and delegate generic constraints.

Testing

  • .\.dotnet\dotnet.exe build test\Microsoft.DotNet.GenAPI.Tests\Microsoft.DotNet.GenAPI.Tests.csproj -p:SdkTargetFramework=net10.0 --no-restore
  • .\.dotnet\dotnet.exe exec artifacts\bin\Microsoft.DotNet.GenAPI.Tests\Debug\net10.0\Microsoft.DotNet.GenAPI.Tests.dll -method "*TestAllowsRefStructGenericConstraintGeneration*" -method "*TestNotNullGenericConstraintGeneration*" -method "*TestSynthesizePrivateFieldsForNestedGenericTypes*" -method "*TestSynthesizePrivateFieldsAngleBrackets*"

Extend GenAPI reference source generation to preserve allows ref struct generic constraints from metadata.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ViktorHofer ViktorHofer requested a review from a team as a code owner May 27, 2026 07:30
@ViktorHofer ViktorHofer merged commit 1a5923d into fix-genapi-notnull-constraints May 27, 2026
5 of 7 checks passed
@ViktorHofer ViktorHofer deleted the fix-genapi-allows-ref-struct branch May 27, 2026 07:57
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