DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform
MIT License
2.61k stars 506 forks source link

SA1010 conflicts with SA1024 when invoking a method using named arguments with collection expression #3865

Closed a-herbst closed 1 week ago

a-herbst commented 1 week ago

The call of the ShiftValues() method in the example below raises either a SA1010 issue: ShiftValues(values: [1, 2, 3], offset: 3);

or - if you remove the space character - a SA1024 issue: ShiftValues(values:[1, 2, 3], offset: 3);

using System.Linq;

namespace PriceCalculationContext.DomainServices;
public class Program
{
    private static int[] ShiftValues(int[] values, int offset)
        => values.Select(v => v + offset).ToArray();

    public static void Main()
    {
        ShiftValues(values: [1, 2, 3], offset: 3);
    }
}
a-herbst commented 1 week ago

This happens in 1.2.0-beta556

bjornhellander commented 1 week ago

Can't reproduct this. I see it when using 1.2.0-beta507, but not with beta 556. Seems consistent with the fix for #3687.

a-herbst commented 1 week ago

You are right, I had a another project in my solution that still used the older beta version 354 and that caused these issues.