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

SA1202: Incorrectly identifying static constructors as private constructors #1155

Closed
FlatlinerDOA opened this issue Aug 8, 2015 · 5 comments
Assignees
Milestone

Comments

@FlatlinerDOA
Copy link

Example:

class MyClass
{
    static MyClass()
    {
    }

    public MyClass()
    {
    }
}

Incorrectly reports SA1202: All public constructors must come before private constructors

@sharwell
Copy link
Member

sharwell commented Aug 8, 2015

@Noryoko I figure I can just go ahead and assign this to you. 😄

@FlatlinerDOA @Noryoko @oatkins Can one of you verify the original StyleCop behavior for this code sample?

@Noryoko
Copy link
Contributor

Noryoko commented Aug 8, 2015

The example order is correct in classic.

class MyClass
{
    public MyClass()
    {
    }

    static MyClass()
    {
    }
}

Triggers SA1204.

@FlatlinerDOA
Copy link
Author

@Noryoko ok, my apologies, we have a large code base that had StyleCop enabled, and it appears we have a project that has slipped through the cracks on that one.

@Noryoko
Copy link
Contributor

Noryoko commented Aug 8, 2015

@FlatlinerDOA I think my wording could have been better. Your example is correct. The example I included will trigger SA1204.

@sharwell
Copy link
Member

sharwell commented Aug 8, 2015

Thanks @Noryoko and sorry for the confusion @FlatlinerDOA. We should have this fixed for today's release. 👍

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

No branches or pull requests

3 participants