I'm using StyleCop.Analyzers version, 1.2.0-beta.376.
When given a file named Example.cs with the following content using file-scoped namespaces in C# 10:
namespace MyExample;
public class TestClass1
{
}
public class TestClass2
{
}
The rules SA1649 - File name should match first type name and SA1402 File may only contain a single type stop working. When switching back to block-scoped namespaces, the rules start working again. The following code triggers the rules correctly.
namespace MyExample
{
public class TestClass1
{
}
public class TestClass2
{
}
}
There may be other rules that don't work when using file-scoped namespaces in C# 10. I've only discovered these two.
I'm using StyleCop.Analyzers version, 1.2.0-beta.376.
When given a file named
Example.cswith the following content using file-scoped namespaces in C# 10:The rules
SA1649 - File name should match first type nameandSA1402 File may only contain a single typestop working. When switching back to block-scoped namespaces, the rules start working again. The following code triggers the rules correctly.There may be other rules that don't work when using file-scoped namespaces in C# 10. I've only discovered these two.