I'm getting a StyleCop error that I'm unsure how to fix, other than adding a suppression message on my class, which is bad practice. If you know how to fix this, or know if this is just a StyleCop bug or flaw, please let me know.
Note: I don't know if this makes a difference, but I am using the Visual StyleCop extension by HEISER Christophe for Visual Studio 2015.
I have an internal class with internal properties. Example:
internal bool Property1 { get; set; }
internal int Property2 { get; private set; }
Regardless of the fact that all my properties have the internal accessor, and are ordered within the class properly, according to the StyleCop and Visual StyleCop Ordering Rules documentation, I still receive the SA1202 error "All private properties must be placed after all internal properties". That error doesn't make sense to me since all my properties have internal access. I assume it's because of the private set, but even if I order all the properties with private setters after (or even before) properties without private setters, I keep receiving the same error. It almost seems to me that StyleCop does not recognize or work properly with this situation.
Any ideas on how to fix this (without a suppression message on the class) or if this is just a bug/flaw in StyleCop?
Jafo, could you paste the complete code of your class here : Visual StyleCop - GitHub - Issue 47 because it works on my side with the following code :
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="InternalClass.cs" company="TestCompany">
// MS-PL
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace ConsoleApplication10
{
/// <summary>
/// Test internal class.
/// </summary>
internal class InternalClass
{
/// <summary>
/// Gets or sets a value indicating whether the property one.
/// </summary>
internal bool Property1 { get; set; }
/// <summary>
/// Gets the property two.
/// </summary>
internal int Property2 { get; private set; }
}
}