SA1101 Incorrectly warns about nested generic interfaces

Jun 24, 2012 at 4:30 PM

StyleCop warns about SA1101 with message

The call to IDoStuff<> must begin with the 'this.' prefix to indicate that the item is a member of the class.

IDoStuff<> is a generic type is a public nested generic interface, which is used in an instance (test) method as follows:

container.RegisterOpenGeneric(typeof(IDoStuff<>), typeof(DefaultStuffDoer<>));

And it is defined at the top of that class as follows:

        public interface IDoStuff<T>
        {
            IService<T, int> Service { get; }
        }

Coordinator
Jun 25, 2012 at 9:43 PM
Edited Jun 29, 2012 at 10:17 AM
Which version of stylecop please?


~A.
Jun 25, 2012 at 9:55 PM

4.7.32.  `Downloaded it yesterday.

Jun 25, 2012 at 11:21 PM

I see a similar problem in 4.7.32.0 with the use of the "default" keyword with respect to generics. However it's SA1126 instead of SA1101.

Coordinator
Jun 29, 2012 at 10:18 AM

@jalbert: can you attach a code sample or open a bug please so I can fix it.

Coordinator
Jun 29, 2012 at 10:44 AM

Nested interfaces fixed in 4.7.33

Jun 29, 2012 at 11:13 AM

Cool! Thank!

Jun 29, 2012 at 8:17 PM

@andyr, I have created issue 7344. Thank you.