DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SA1200 Using directive should appear within a namespace declaration

daleao opened this issue · comments

Conflicts with CS8914 Error: A global using directive cannot be used in a namespace declaration.

Could you provide an example so your situation is clear?

This causes SA1200:

global using static Foo.Bar;

namespace Foo;

using System;

class Bar {}

This causes CS8914:

namespace Foo;

global using static Foo.Bar;
using System;

class Bar {}

SA1200 is incorrectly applying to global using statements, which cannot be placed within namespace declarations.

Duplicate of #3404 (still open)

Duplicate of #3404