roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Rename the record parameter when its property get renamed

Open Cosifne opened this issue 7 months ago • 0 comments

Fix https://github.com/dotnet/roslyn/issues/72581

Reason: Using code snnipet

    public record MyRecord(string MyProperty);
    public class ReferenceClass
    {
        public static void Test()
        {
            var record = new MyRecord("HelloWorld");
            var c = record.MyProperty;
        }
    }

When we rename the MyProperty in constructor, we are renaming the parameter, var c = record.MyProperty is not renamed, because it's referencing the generated property.

This PR fix by adding an additional check.

Cosifne avatar Jun 26 '24 18:06 Cosifne