-
Notifications
You must be signed in to change notification settings - Fork 513
Closed
Milestone
Description
A file containing this code:
namespace MyProgram;
public delegate void Foo<T>(T arg);should be called "Foo`1.cs" (assuming fileNamingConvention = "metadata" in stylecop.json). Yet SA1649 (File name should match first type name) is triggered unless the file name is "Foo.cs".
Things start going downhill fast if you have multiple Foo<> delegates:
namespace MyProgram;
public delegate void Foo<T>(T arg);
public delegate void Foo<T1,T2>(T1 arg1, T2 arg2);Now the two delegate types cannot be in two separate files, as they should both be names "Foo.cs". However, keeping them both in "Foo.cs" triggers SA1402 (File may only contain a single type).
The possible workarounds are pretty obvious (either disable SA1402 in "Foo.cs", or disable SA1649 in all "Foo`{n}.cs" files) but this behavior of SA1649 still looks like a bug to me.