Skip to content

Move static members to another type... doesn't modify references to static members it doesn't move #79806

@AdmiralSnyder

Description

@AdmiralSnyder

Version Used:
VS 2022 17.14.11

Steps to Reproduce:

  1. put this code into a .cs file
internal class ClassWithStaticMembers
{

    public static int StaticInt { get; set; }
    public static string StaticString { get; set; }
    public static void StaticMethod()
    {
        Console.WriteLine(StaticString + StaticInt);
    }
}
  1. execute Move static members to another type... from the context menu of StaticMethod()
  2. do not select other members, and hit OK
  3. observe that the method in the created file looks like this
    public static void StaticMethod()
    {
        Console.WriteLine(StaticString + StaticInt);
    }

instead of this

    public static void StaticMethod()
    {
        Console.WriteLine(ClassWithStaticMembers.StaticString + ClassWithStaticMembers.StaticInt);
    }

Expected Behavior:
references to static members in the source class that are not moved should now be qualified with the identifier of the source class
Actual Behavior:
references to static members are not qualified, yielding uncompiling code.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions