Skip to content

SA1135 doesn't fire when using file-scoped namespace syntax #3415

@zizhengtai

Description

@zizhengtai
  • C# 10
  • .NET 6
  • StyleCop 1.2.0-beta.354

When a project uses the root project namespace My.Project, and has the following sub-namespaces:

  • My.Project.Foo
  • My.Project.Bar

SA1135 works as expected when using the old namespace syntax:

namespace My.Project.Bar
{
    using Foo;  // <-- not fully qualified, triggers SA1135
}

However, it doesn't fire when using the new file-scoped namespace syntax:

namespace My.Project.Bar;

using Foo;  // <-- doesn't trigger SA1135

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions