Clarify CS0112 scope for C# 11 static interface members#53157
Open
Clarify CS0112 scope for C# 11 static interface members#53157
Conversation
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/575e2a27-b97e-4b8f-91a4-d0ccbb63de4b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/575e2a27-b97e-4b8f-91a4-d0ccbb63de4b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/575e2a27-b97e-4b8f-91a4-d0ccbb63de4b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/575e2a27-b97e-4b8f-91a4-d0ccbb63de4b Co-authored-by: BillWagner <[email protected]>
Copilot
AI
changed the title
[WIP] Update CS0112 member modifier combinations help text
Clarify CS0112 scope for C# 11 static interface members
Apr 15, 2026
BillWagner
reviewed
Apr 15, 2026
BillWagner
reviewed
Apr 15, 2026
Member
BillWagner
left a comment
There was a problem hiding this comment.
@copilot Address my comment on L17 and this is ready.
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/144c5760-2105-4bac-9d18-3ba843bb7a2b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/144c5760-2105-4bac-9d18-3ba843bb7a2b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/144c5760-2105-4bac-9d18-3ba843bb7a2b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/144c5760-2105-4bac-9d18-3ba843bb7a2b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/144c5760-2105-4bac-9d18-3ba843bb7a2b Co-authored-by: BillWagner <[email protected]>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/144c5760-2105-4bac-9d18-3ba843bb7a2b Co-authored-by: BillWagner <[email protected]>
Contributor
Author
Addressed in commit |
BillWagner
reviewed
Apr 15, 2026
Co-authored-by: Bill Wagner <[email protected]>
BillWagner
approved these changes
Apr 15, 2026
Member
BillWagner
left a comment
There was a problem hiding this comment.
This is ready for final review.
Contributor
There was a problem hiding this comment.
Pull request overview
Clarifies the scope of compiler error CS0112 so the guidance doesn’t conflict with C# 11’s support for static abstract and static virtual interface members.
Changes:
- Updates the CS0112 lead sentence to scope the rule to class and struct members.
- Revises the explanatory text to consistently format keywords and clarify invalid modifier combinations.
- Adds a note calling out the C# 11 interface-member exception for
static abstract/static virtual.
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/2c459477-12a9-4963-a7dd-1fac093fbd5e Co-authored-by: BillWagner <[email protected]>
BillWagner
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CS0112 docs currently imply
staticcan’t combine withabstract/virtualin all contexts. Since C# 11 allowsstatic abstractandstatic virtualon specific interface members, the guidance needed scope clarification.Scope correction
Rule clarification
override/virtual/abstract+staticis invalid in class/struct member declarations.C# 11 exception added
static abstractandstatic virtual.Consistency cleanup
Internal previews