Steps to Reproduce:
- Create a class with at least one generic type parameter that is used in a member:
public class C<T>
{
public T M()
{
return default;
}
public T testField;
}
- Trigger the quick actions menu on the class declaration or a member declaration and select Extract Base Class
- Select any or all members and perform the refactoring
Expected Behavior:
The generated class will have type parameters that were necessary for the members that are moved:
public class CBase<T>
{
public T M()
{
return default;
}
public T testField;
}
Actual Behavior:
The generated class has no type parameters, causing "T" to produce an error as it is unqualified:
public class CBase
{
public T M() // There is no T here
{
return default;
}
public T testField;
}
While the generated type name produces a generic preview when there are type parameters used as members, and will fill in the required type parameters when certain members are selected, it does not update with the correct type parameters when a type parameter is used within a method (not in the return value or argument list), and does not update when it is used in a field.
There is an ExtractTypeHelpers class that is used for the preview, but not for the actual refactoring. It seems designed for extracting interfaces, and doesn't work on fields, so maybe there are two separate issues. One for Extract Base Class not doing anything generic, and one for Extract Type Helpers only working on interface-like members (i.e. not fields, not looking inside member bodies).
Steps to Reproduce:
Expected Behavior:
The generated class will have type parameters that were necessary for the members that are moved:
Actual Behavior:
The generated class has no type parameters, causing "T" to produce an error as it is unqualified:
While the generated type name produces a generic preview when there are type parameters used as members, and will fill in the required type parameters when certain members are selected, it does not update with the correct type parameters when a type parameter is used within a method (not in the return value or argument list), and does not update when it is used in a field.
There is an
ExtractTypeHelpersclass that is used for the preview, but not for the actual refactoring. It seems designed for extracting interfaces, and doesn't work on fields, so maybe there are two separate issues. One for Extract Base Class not doing anything generic, and one for Extract Type Helpers only working on interface-like members (i.e. not fields, not looking inside member bodies).