Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCS1102 triggers false positive when inherited by nested class #977

Closed
gtbuchanan opened this issue Oct 31, 2022 · 0 comments · Fixed by #978
Closed

RCS1102 triggers false positive when inherited by nested class #977

gtbuchanan opened this issue Oct 31, 2022 · 0 comments · Fixed by #978
Assignees

Comments

@gtbuchanan
Copy link

Product and Version Used: 4.1.1

Steps to Reproduce:

  1. Create a generic class
  2. Add a nested class (RCS1102 is reported here)
  3. Make the inner class inherit the outer class (RCS1102 is still reported)

This strategy is used in certain unit testing structures where there may be no instance members/methods. For example, passing a type argument to TestFixtureAttribute from NUnit for a generic test fixture requires that the nested class inherit from the child class in the aforementioned structure.

Actual Behavior:

public class Class1<T> // RCS1102 is reported on Class1
{
    public sealed class Class2 : Class1<T>
    {
    }
}

Expected Behavior:
RCS1102 should not be reported since it is being inherited by the nested class. Making Class1 static in this case would result in a compilation error due to the inheritance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants