Skip to content

Do not report CA1815 on union declarations - #55950

Merged
krwq merged 3 commits into
dotnet:mainfrom
verdie-g:ca1815-union
Sep 2, 2026
Merged

krwq merged 3 commits into
dotnet:mainfrom
verdie-g:ca1815-union

Conversation

@verdie-g

Copy link
Copy Markdown
Contributor

Closes #55949

@verdie-g
verdie-g requested a review from a team as a code owner August 26, 2026 17:11
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Comment on lines +111 to +112
[System.Runtime.CompilerServices.Union]
public struct A : System.Runtime.CompilerServices.IUnion

@krwq krwq Sep 1, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this combines detection through both attribute and interface. consider splitting this test so we also have coverage for one but not the other way (either attribute or IUnion). otherwise a regression in either lookup is masked by the other via the || in the production check.

@krwq krwq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added optional comment

@krwq
krwq merged commit 917f04d into dotnet:main Sep 2, 2026
24 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 3, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 9fc43c1e Deployed Sep 2, 2026 by krwq via pre_activation #2430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CA1815 should not report on union declarations

3 participants