dotnet/roslyn

WRN_ParamsArrayInLambdaOnly doesn't have single quotes around its argument.

Open

#66,389 opened on 2023年1月12日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-CompilersConcept-Diagnostic Clarityhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

  <data name="WRN_ParamsArrayInLambdaOnly" xml:space="preserve">
    <value>Parameter {0} has params modifier in lambda but not in target delegate type.</value>
  </data>

This is inconsistent with other diagnostics that we produce. Also the arguments blends in in the message. For example:

                // (67,49): warning CS9100: Parameter 1 has params modifier in lambda but not in target delegate type.
                //         Action<string[]> q17 = (params string[] s)=>{};
                Diagnostic(ErrorCode.WRN_ParamsArrayInLambdaOnly, "s").WithArguments("1").WithLocation(67, 49),

Another aspect to consider is, if we always use parameter number for the argument, then it might make sense to include the word "number" into the message. Number "1" could easily be confused with letter "l", for example, and interpreted as a name instead.

コントリビューターガイド