SA1101 Incorrectly warns about nested generic interfaces

Jun 24, 2012 at 3: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; }

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

Jun 25, 2012 at 8:55 PM

4.7.32.  `Downloaded it yesterday.

Jun 25, 2012 at 10:21 PM

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

Jun 29, 2012 at 9:18 AM

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

Jun 29, 2012 at 9:44 AM

Nested interfaces fixed in 4.7.33

Jun 29, 2012 at 10:13 AM

Cool! Thank!

Jun 29, 2012 at 7:17 PM

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