question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SA1313: Parameter '__' must begin with lower-case letter.

See original GitHub issue

The following code snippet is OK in StyleCop 4.6, but not in StyleCopAnalyzers:

Action<object, object> b = (_, __) => { };

The warning output is warning SA1313: Parameter '__' must begin with lower-case letter.

StyleCopAnalyzers seems to be OK with a single underscore, but not two underscores. I assume this is due to https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/StyleCop.Analyzers/StyleCop.Analyzers/NamingRules/SA1313ParameterNamesMustBeginWithLowerCaseLetter.cs#L86 explicitly checking for a single underscore.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
GraemeBradburycommented, Dec 3, 2015

To add my two cents to this.

WPF has a very common type RoutedEventHandler so seeing (_,__) => {...} when responding to events is rather normal.

While it would be better if C# supported _ as a syntax for ignored parameters (like other languages). Using multiple underscore to communicate parameters as being unused is still better than using comments to communicate unuse. It also falls into line with alot of the teaching out there for functional programming.

1reaction
chaddrellunlimitiedcommented, May 2, 2019

The stable 1.1.118 fixes this, and is making my code better in new ways.

Read more comments on GitHub >

github_iconTop Results From Across the Web

StyleCopAnalyzers/documentation/SA1313.md at master
The name of a parameter in C# does not begin with a lower-case letter. Rule description. A violation of this rule occurs when...
Read more >
stylecop - StyleCopAnalyzers/SA1313 in a positional record
As properties, these elements should be capitalized, but if I do it, SA1313 complains: Parameter '__' must begin with lower-case letter.
Read more >
Top StyleCop Coding Styles Part 3
SA1113 Comma Must Be on Same Line as Previous Parameter. CORRECT. INCORRECT ... SA1313 Parameter Names Must Begin with Lower Case Letter. CORRECT....
Read more >
The dotnet format command and StyleCop.Analyzers
Variable names should begin with lower-case letter --> <Rule Id="SA1313" Action="Warning" /> <!-- Parameter names should begin with ...
Read more >
https://raw.githubusercontent.com/dotnet/runtime/8...
Variable should begin with lower-case letter --> <Rule Id="SA1313" Action="None" /> <!-- Parameter should begin with lower-case letter --> <Rule Id="SA1314" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found