You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The doc link you're referring to is for CA1801 which is unrelated to IDE1006.
The behavior I'm seeing for IDE1006 seems correct (camel case shouldn't start with _).
CA1801 defines discard parameters as _ or _1 ... .
IDE1006 defines _ as an exception to the naming rules.
This conflict causes fixes to CA1801 to raise IDE1006.
It appears to be a bug that the two rules don't share the same exceptions. Currently the only way to resolve this (when the parameters can't be removed, and are not used) is to add a suppression for one of the errors.
We should recognize this syntax and update the naming style analyzers to ignore "_<#>"
We have concerns that "_1" can be used as a parameter and is not actually recognized as a "true" discard. It can be used like a regular parameter name and not get a warning. This makes us want the language itself to recognize these as discards. (Will bring forward at LDM)
For this case, we should add an analyzer to recommend using a true discard if a "fake" discard is used. Especially as when multiple discards are allowed in C#9.
Version Used:
Microsoft Visual Studio Professional 2019
Version 16.6.3
Steps to Reproduce:
public object DiscardParameter(string _1)
dotnet_naming_rule.parameter_should_be_camelcase.severity = suggestion
dotnet_naming_rule.parameter_should_be_camelcase.symbols = parameter
dotnet_naming_rule.parameter_should_be_camelcase.style = camelcase
Expected Behavior:
No warning
Actual Behavior:
Reference:
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1801?view=vs-2019
Incompatible rules are confusing
The text was updated successfully, but these errors were encountered: