CA1822: Document MarshalByRefObject as an exception to the static-member rule#52763
Merged
Merged
Conversation
…ction Agent-Logs-Url: https://github.com/dotnet/docs/sessions/722092c7-cbfe-4e80-b624-fb626938b567 Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix static methods on MarshalByRefObject inheritance
CA1822: Document MarshalByRefObject as an exception to the static-member rule
Mar 30, 2026
BillWagner
approved these changes
Mar 31, 2026
Member
BillWagner
left a comment
There was a problem hiding this comment.
This is ready for final review.
gewarren
approved these changes
Mar 31, 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.
The CA1822 docs didn't mention that methods on classes inheriting from
MarshalByRefObjectshould not be marked static — the remoting infrastructure relies on instance dispatch across AppDomain boundaries, so static methods break that contract.Changes
ca1822.md— "When to suppress warnings": Converted the single-sentence paragraph into a bullet list and added a new entry forMarshalByRefObjectsubclasses, with a<xref:System.MarshalByRefObject>cross-reference link and a brief explanation of why static breaks remoting.ms.dateto reflect the content change.ai-usage: ai-assistedper documentation guidelines.Internal previews