SA1135.md
September 10, 2018 ยท View on GitHub
SA1135
| TypeName | SA1135UsingDirectivesMustBeQualified |
| CheckId | SA1135 |
| Category | Readability Rules |
:memo: This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.
Cause
A using directive is not qualified.
Rule description
A violation of this rule occurs when a using directive is contained within a namespace and is not qualified. Note that alias definitions of classes within the same namespace do not need to be qualified.
For example, the following code would produce a violation of this rule:
namespace System.Threading
{
using IO;
using Tasks;
}
The following code would not produce any violations:
namespace System.Threading
{
using System.IO;
using System.Threading.Tasks;
using T = Thread;
}
How to fix violations
To fix a violation of this rule, use the full qualified namespace name.
How to suppress violations
namespace N1.N2
{
#pragma warning disable SA1135 // Using directives must be qualified
using N3;
#pragma warning restore SA1135 // Using directives must be qualified
}