Skip to content

Bug CC0095 String Interpolation eats pragmas and comments #929

@KristianWedberg

Description

@KristianWedberg

Bug

The v1.0.3 CC0095 String Interpolation fix for:

    class CC0095
    {
        public static void Report()
        {
            Console.WriteLine(
                "{0}"
#if Choose // Lots
                , 42
#else // Of
                , 24
#endif // Text
                );
        }
    }

eats pragmas and comments:

    class CC0095
    {
        public static void Report()
        {
            Console.WriteLine($"{24}");
        }
    }

Either do not trigger if pragmas and comments are not preserved, or make the fix output:

    class CC0095
    {
        public static void Report()
        {
            Console.WriteLine(
#if Choose // Lots            
                $"{42}"
#else // Of
                $"{24}"
#endif // Text
                );
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions