SA1101 not firing when instance has same name as class.

Apr 11, 2013 at 12:43 PM
If you have a property with the same name as the class it's in, StyleCop (4.7.44.0) does not warn about the missing "this." Here's an example piece of code:
namespace StyleCopThisProblem
{
    using System.Text;

    /// <summary>
    /// My Class
    /// </summary>
    public class MyClass
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MyClass"/> class.
        /// </summary>
        public MyClass()
        {
            StringBuilder = new StringBuilder();

            StringBuilderA = new StringBuilder();
        }

        /// <summary>
        /// Gets or sets the string builder with the same name as the Class.
        /// </summary>
        /// <value>
        /// The string builder.
        /// </value>
        public StringBuilder StringBuilder { get; set; }

        /// <summary>
        /// Gets or sets the string builder with a different name than the Class.
        /// </summary>
        /// <value>
        /// The string builder.
        /// </value>
        public StringBuilder StringBuilderA { get; set; }
    }
}
In the constructor, you get the SA1101 warning for "StringBuilderA", but not for "StringBuilder".