dotnet / roslynator

Roslynator is a set of code analysis tools for C#, powered by Roslyn.
https://josefpihrt.github.io/docs/roslynator
Other
3.1k stars 261 forks source link

Invalid fix of RCS0053 when preprocessor directives are present #1548

Closed josefpihrt closed 1 month ago

josefpihrt commented 1 month ago

Product and Version Used:

Steps to Reproduce:

#define FOO
using System.Collections.Generic;

class C
{
    void M()
    {
        var x = new List<string>(new string[]
            {
                "",
                "",
#if FOO
                "",
#endif
            });
    }
}

Actual Behavior:

#define FOO
using System.Collections.Generic;

class C
{
    void M()
    {
        var x = new List<string>(new string[]
        {
            "",
            "",
#if FOO
                "",
#endif
            });
    }
}

Expected Behavior:

#define FOO
using System.Collections.Generic;

class C
{
    void M()
    {
        var x = new List<string>(new string[]
        {
            "",
            "",
#if FOO
            "",
#endif
        });
    }
}
josefpihrt commented 1 month ago

fixed with #1547