Repository navigation
Don't report CA1704 for parameters named _ - #86288
Merged
jasonmalinowski merged 1 commit intoNov 3, 2026
Merged
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
jasonmalinowski
approved these changes
Nov 3, 2026
Member
|
Yes, that's quite reasonable. 😄 |
This was referenced Nov 3, 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.
Related to dotnet/roslyn-analyzers#5183, follow-up to #85161
@jasonmalinowski @CyrusNajmabadi you mentioned being open to a few more special cases if they present themselves; this is the next one.
Problem
CA1704reports_as an unmeaningful parameter name:_is the established way to mark a parameter that a signature requires but the method does not use. IDE0060 (remove unused parameter) explicitly skips parameters named_,_1, … for that reason (IsSymbolWithSpecialDiscardName). So the two analyzers contradict each other:_→ CA1704context→ IDE0060On one mid-size codebase, after #85161, 20 of the remaining 103 CA1704 findings were parameters named
_.Change
A parameter named
_is no longer reported by CA1704._1,__etc. were never reported (longer than one character, no words to spell check)_are unaffected (the_prefix is stripped, nothing remains)Notes for review
Tests
In
IdentifiersShouldBeSpelledCorrectlyTests:_as method, constructor and delegate parameter → no diagnosticMicrosoft Reviewers: Open in CodeFlow