498 references to HDN_UnusedUsingDirective
Microsoft.CodeAnalysis.CSharp (3)
Compilation\CSharpCompilation.cs (1)
2404
: ErrorCode.
HDN_UnusedUsingDirective
;
Errors\ErrorFacts.cs (1)
1611
case ErrorCode.
HDN_UnusedUsingDirective
:
Generated\ErrorFacts.Generated.cs (1)
356
case ErrorCode.
HDN_UnusedUsingDirective
:
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (52)
CodeGen\CodeGenAsyncIteratorTests.cs (1)
7573
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Runtime.CompilerServices;").WithLocation(2, 1),
CodeGen\CodeGenAsyncMainTests.cs (2)
248
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(2, 1));
285
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(2, 1));
CodeGen\CodeGenAwaitForeachTests.cs (2)
7849
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N3;").WithLocation(5, 1));
7954
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N2;").WithLocation(5, 1),
CodeGen\CodeGenForEachTests.cs (1)
5073
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N2;").WithLocation(4, 1),
CodeGen\CodeGenOperators.cs (2)
2296
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;").WithLocation(3, 1),
2299
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;").WithLocation(4, 1),
CodeGen\CodeGenTupleTest.cs (2)
5411
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using VT2 = (int, int);").WithLocation(2, 1));
5418
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using VT2 = (int, int);").WithLocation(2, 1));
PDB\PDBUsingTests.cs (41)
880
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = B::N;").WithLocation(5, 1),
883
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = A::N;").WithLocation(4, 1),
886
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Z = global::N;").WithLocation(6, 1));
1027
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
1030
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU1 = System;"),
1033
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT1 = System.Char;"),
1039
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU2 = System.IO;"),
1042
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT2 = System.IO.Directory;"),
1045
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.IO;"),
1051
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT3 = System.Text.StringBuilder;"),
1054
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Text;"),
1057
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU3 = System.Text;"),
1333
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
1336
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU1 = System;"),
1339
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT1 = System.Char;"),
1345
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU3 = System.Threading;"),
1348
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT3 = System.Threading.Thread;"),
1351
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading;"),
1357
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU2 = System.IO;"),
1360
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT2 = System.IO.Directory;"),
1363
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.IO;"),
1512
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
1515
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU1 = System;"),
1518
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT1 = System.Char;"),
1524
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Text;"),
1527
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU3 = System.Text;"),
1530
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT3 = System.Text.StringBuilder;"),
1533
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU2 = System.IO;"),
1539
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT2 = System.IO.Directory;"),
1542
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.IO;"),
1545
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AU4 = System.Threading;"),
1551
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using AT4 = System.Threading.Thread;"),
1554
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading;"),
2496
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = A::E;").WithLocation(5, 1),
2499
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using B;").WithLocation(3, 1),
2502
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = C.D;").WithLocation(4, 1),
2505
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Z = F<int>;").WithLocation(6, 1)
2621
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N.SBad;"),
2624
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NIBad = N.IBad;"),
2627
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using ZBad = N.SBad;"));
2691
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = N.B;"));
Perf.cs (1)
36
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using nested;"));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (4)
Attributes\AttributeTests.cs (1)
8141
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
Attributes\AttributeTests_WellKnownAttributes.cs (2)
7211
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = A;"),
7214
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = A.B;"));
Semantics\PatternMatchingTests2.cs (1)
1279
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using _ = System.Int32;").WithLocation(1, 1)
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler.UnitTests (3)
DebuggerDisplayAttributeTests.cs (3)
300
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = int;").WithLocation(2, 1),
303
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using B = (int, int);").WithLocation(3, 1),
306
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using C = int[];").WithLocation(4, 1));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (216)
Semantics\BindingTests.cs (3)
3385
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static Test<System.String>;").WithLocation(2, 1),
3405
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static A<A<int>[]>.B;").WithLocation(2, 1),
3421
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static A<int, string>;").WithLocation(2, 1),
Semantics\FunctionPointerTests.cs (9)
45
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using s = delegate*<void>;").WithLocation(2, 1));
57
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using s = delegate*<void>;").WithLocation(2, 1));
74
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe S = delegate*<void>;").WithLocation(2, 1));
81
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe S = delegate*<void>;").WithLocation(2, 1));
88
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe S = delegate*<void>;").WithLocation(2, 1));
101
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using S = System.Collections.Generic.List<delegate*<void>[]>;").WithLocation(2, 1));
107
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using S = System.Collections.Generic.List<delegate*<void>[]>;").WithLocation(2, 1),
126
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe S = System.Collections.Generic.List<delegate*<void>[]>;").WithLocation(2, 1));
132
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe S = System.Collections.Generic.List<delegate*<void>[]>;").WithLocation(2, 1));
Semantics\GlobalUsingDirectiveTests.cs (157)
887
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
890
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
893
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
896
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
958
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
961
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
964
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
1062
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
1112
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
1531
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
1551
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
1554
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
1557
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
1591
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
1611
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
1614
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
1928
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
1964
comp.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2074
comp2.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2084
comp3.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2097
comp4.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2127
comp5.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(expected1);
2130
comp6.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2140
comp7.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2153
comp8.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(expected1);
2156
comp9.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2169
comp10.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(
2216
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(expected);
2219
comp2.GetSemanticModel(comp2.SyntaxTrees[2]).GetDeclarationDiagnostics().Where(d => d.Code is not ((int)ErrorCode.
HDN_UnusedUsingDirective
or (int)ErrorCode.HDN_UnusedExternAlias)).Verify(expected);
2251
comp2.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2265
comp3.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2268
comp4.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2271
comp5.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2274
comp6.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2277
comp7.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2280
comp8.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2283
comp9.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2301
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2308
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2338
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2341
comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2344
comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2396
comp2.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2413
comp3.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2416
comp4.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2419
comp5.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2422
comp6.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2425
comp7.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2428
comp8.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2431
comp9.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2492
comp2.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2509
comp3.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2512
comp4.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2515
comp5.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2518
comp6.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2521
comp7.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2524
comp8.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2527
comp9.GetDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
2557
CompileAndVerify(comp2).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2561
CompileAndVerify(comp3).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2571
CompileAndVerify(comp4).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2578
CompileAndVerify(comp5).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2588
CompileAndVerify(comp6).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2598
CompileAndVerify(comp7).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2608
CompileAndVerify(comp8).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2611
CompileAndVerify(comp9).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2635
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2642
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2671
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2674
comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2677
comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2711
CompileAndVerify(comp2).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2715
CompileAndVerify(comp3).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2725
CompileAndVerify(comp4).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2732
CompileAndVerify(comp5).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2742
CompileAndVerify(comp6).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2752
CompileAndVerify(comp7).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2762
CompileAndVerify(comp8).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
2765
CompileAndVerify(comp9).Diagnostics.Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2789
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2796
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2825
comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2828
comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected);
2831
comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDeclarationDiagnostics().Where(d => d.Code != (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
2877
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias1 = C2;").WithLocation(1000, 1),
2880
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias3 = C4;").WithLocation(3000, 1),
2883
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using alias4 = C2;").WithLocation(4000, 1)
2892
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias1 = C2;").WithLocation(1000, 1)
2899
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias3 = C4;").WithLocation(3000, 1),
2902
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using alias4 = C2;").WithLocation(4000, 1)
2963
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C2;").WithLocation(1000, 1),
2966
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C4;").WithLocation(3000, 1),
2969
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C5;").WithLocation(4000, 1)
2978
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C2;").WithLocation(1000, 1)
2985
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C4;").WithLocation(3000, 1),
2988
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C5;").WithLocation(4000, 1)
3049
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using C2;").WithLocation(1000, 1),
3052
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using C4;").WithLocation(3000, 1),
3055
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using C5;").WithLocation(4000, 1)
3064
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using C2;").WithLocation(1000, 1)
3071
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using C4;").WithLocation(3000, 1),
3074
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using C5;").WithLocation(4000, 1)
3177
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using N2;").WithLocation(1000, 1),
3180
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N5;").WithLocation(4000, 1),
3183
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N8;").WithLocation(6000, 1),
3210
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using N2;").WithLocation(1000, 1),
3223
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N5;").WithLocation(4000, 1),
3236
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N8;").WithLocation(6000, 1),
3385
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using alias2 = System;").WithLocation(4, 1)
3393
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using alias2 = System;").WithLocation(4, 1)
3401
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using alias2 = System;").WithLocation(2, 1)
3409
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using alias2 = System;").WithLocation(2, 1)
3417
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias2 = System;").WithLocation(2, 1)
3425
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias2 = System;").WithLocation(2, 1)
3433
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias2 = System;").WithLocation(2, 1)
3441
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias2 = System;").WithLocation(2, 1)
4221
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.ERR_DuplicateAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected1);
4224
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.ERR_DuplicateAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected1);
4227
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.ERR_DuplicateAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(
4241
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected2);
4249
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected2);
4257
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.ERR_DuplicateAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected1);
4260
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.ERR_DuplicateAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected1);
4263
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.ERR_DuplicateAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(
4277
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected3);
4285
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected3);
4293
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected3);
4301
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(expected3);
4309
comp.GetDiagnostics().Where(d => d.Code is not ((int)ErrorCode.ERR_BadExternAlias or (int)ErrorCode.
HDN_UnusedUsingDirective
)).Verify(
4375
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4378
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4381
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4384
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4387
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
4394
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
4401
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
4471
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4474
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4477
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4480
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4483
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
4490
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
4497
comp.GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
4568
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using NS;").WithLocation(1000, 1)
4586
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C2;").WithLocation(2000, 1)
4602
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NS;").WithLocation(3000, 1)
4613
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C2;").WithLocation(4000, 1)
4684
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using NS;").WithLocation(1000, 1)
4717
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C2;").WithLocation(2000, 1)
4750
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NS;").WithLocation(3000, 1)
4771
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C2;").WithLocation(4000, 1)
4926
GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4929
GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4932
GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected1);
4945
GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
4948
GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(expected2);
4951
GetDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
Semantics\InheritanceBindingTests.cs (1)
1373
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @str = System.String;").WithLocation(2, 1));
Semantics\LookupTests.cs (1)
1621
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = List<int>;").WithLocation(1, 1));
Semantics\NameCollisionTests.cs (2)
2002
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static Static<System.String>;").WithLocation(3, 1));
2034
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static Static<string>;").WithLocation(2, 1));
Semantics\NativeIntegerTests.cs (5)
3837
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A=nint;").WithLocation(1, 1),
3846
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A=nint;").WithLocation(1, 1),
3855
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A=nint;").WithLocation(1, 1),
3921
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using nint;").WithLocation(1, 1),
3927
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using nuint;").WithLocation(2, 1),
Semantics\NullableReferenceTypesTests.cs (2)
14427
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;").WithLocation(4, 1),
14430
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Text;").WithLocation(5, 1),
Semantics\OverloadResolutionTests.cs (1)
7594
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;").WithLocation(2, 1)
Semantics\PrimaryConstructorTests.cs (2)
8866
comp.GetEmitDiagnostics().Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
).Verify(
10767
var diagnostics = verifier.Diagnostics.Where(d => d.Code is not (int)ErrorCode.
HDN_UnusedUsingDirective
);
Semantics\QueryTests.cs (1)
3594
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
Semantics\RecordTests.cs (3)
2903
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using record = System.Console;").WithLocation(2, 1),
2920
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @record = System.Console;").WithLocation(2, 1)
24433
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1),
Semantics\RefFieldTests.cs (4)
21748
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using scoped = System.Int32;").WithLocation(1, 1),
21758
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using scoped = System.Int32;").WithLocation(1, 1),
21775
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @scoped = System.Int32;").WithLocation(1, 1)
21782
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @scoped = System.Int32;").WithLocation(1, 1)
Semantics\SemanticErrorTests.cs (1)
2420
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1)
Semantics\TopLevelStatementsTests.cs (2)
3769
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N2;").WithLocation(2, 1),
3837
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N2;").WithLocation(2, 1),
Semantics\UnsafeTests.cs (22)
9848
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int*;").WithLocation(2, 1),
9868
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int;").WithLocation(2, 1),
9884
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int*;").WithLocation(2, 1),
9903
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int;").WithLocation(2, 1),
9922
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int*;").WithLocation(2, 1),
9938
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int;").WithLocation(2, 1),
9954
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = System.String;").WithLocation(2, 1),
9973
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = System.String;").WithLocation(2, 1),
10022
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = X;").WithLocation(5, 5),
10042
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe Y = X;").WithLocation(5, 5));
10060
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int*;").WithLocation(2, 1),
10133
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = int*[];").WithLocation(2, 1));
10146
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int*[];").WithLocation(2, 1),
10279
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = delegate*<int,int>;").WithLocation(2, 1),
10325
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = delegate*<int,int>[];").WithLocation(2, 1),
10328
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = delegate*<int,int>[];").WithLocation(3, 1),
10441
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System.Collections.Generic.List<int*>;").WithLocation(2, 1),
10457
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System.Collections.Generic.List<int*>;").WithLocation(2, 1),
10598
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System.Collections.Generic.List<int*[]>;").WithLocation(2, 1)
10610
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System.Collections.Generic.List<int*[]>;").WithLocation(2, 1),
10706
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = System.Collections.Generic.List<int*[]>;").WithLocation(2, 1));
10712
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe X = System.Collections.Generic.List<int*[]>;").WithLocation(2, 1),
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (100)
Compilation\GetUnusedImportDirectivesTests.cs (18)
38
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
102
model.GetDiagnostics().Verify(Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using ClassLibrary2;"));
133
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"),
136
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
139
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
142
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading.Tasks;")
149
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
152
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
155
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading.Tasks;")
205
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;")
285
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"),
288
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;")
295
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"),
298
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;")
333
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"),
336
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using C = System.Console;"));
383
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithWarningAsError(false));
404
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
Compilation\SemanticModelAPITests.cs (2)
1240
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System;"));
1333
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System;"));
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
4529
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Alias = Goo;"));
4566
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Alias = Goo;"));
Compilation\UsedAssembliesTests.cs (20)
219
if (old.Code is (int)ErrorCode.
HDN_UnusedUsingDirective
)
1839
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C1;").WithLocation(1001, 1),
2179
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1;").WithLocation(1001, 1)
2192
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N1.C1;").WithLocation(1001, 1)
2205
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @alias = N1.C1;").WithLocation(1001, 1)
2218
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @alias = N1;").WithLocation(1001, 1)
2244
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1;").WithLocation(2, 1)
2257
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N1.C1;").WithLocation(2, 1)
2270
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @alias = N1.C1;").WithLocation(2, 1)
2283
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @alias = N1;").WithLocation(2, 1)
4461
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1.N2;").WithLocation(1001, 1)
4466
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1.N2;").WithLocation(1001, 1),
4490
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1;").WithLocation(1001, 1)
4495
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1;").WithLocation(1001, 1),
4681
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N1.N2.E0;").WithLocation(1001, 1)
4686
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static N1.N2.E0;").WithLocation(1001, 1),
5187
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C1;").WithLocation(1001, 1),
5209
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C1;").WithLocation(1001, 1),
5248
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C1;").WithLocation(1001, 1),
5287
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C1;").WithLocation(1001, 1),
DocumentationComments\CrefTests.cs (2)
5281
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
6867
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1));
Symbols\AssemblyAndNamespaceTests.cs (4)
425
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading;"),
428
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading.Tasks;"),
561
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1));
574
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(2, 1));
Symbols\ExtensionMethodTests.cs (3)
3410
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NB;"));
3708
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static Program;").WithLocation(4, 5));
3743
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = N.S;").WithLocation(4, 5));
Symbols\GenericConstraintTests.cs (4)
789
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = C<int>;"));
823
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = C<I<int?>>;"),
826
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using B1 = C<I<int>>.D1<object>;"),
829
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using B2 = C<int>.D2<string>;"));
Symbols\Metadata\PE\TypeForwarders.cs (2)
951
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Namespace;"));
987
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Namespace;"));
Symbols\Source\BaseClassTests.cs (4)
1983
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using D;").WithLocation(2, 1),
1986
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A<int>.B;").WithLocation(1, 1)
2010
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static A<int>.B;").WithLocation(1, 1)
2207
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using CrashTest.Crash<CrashTest.Class2>;").WithLocation(2, 1)
Symbols\Source\ExternAliasTests.cs (1)
167
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Bar = System.Console;"),
Symbols\Source\FileModifierTests.cs (3)
2835
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static C;").WithLocation(1, 1),
2874
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static Container<C>;").WithLocation(1, 1),
2993
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static C;").WithLocation(2, 1));
Symbols\SymbolErrorTests.cs (33)
2538
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Object;"),
2541
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NS.S;"));
3407
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NoExistNS1;"),
3410
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NoExistNS2;"));
3859
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using NIA = N.IA;").WithLocation(1, 1));
4441
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1),
4492
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using COfArgIterator = C<System.ArgIterator>;").WithLocation(3, 1));
4515
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using COfArgIterator = C<System.ArgIterator>;").WithLocation(3, 1));
14991
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = System;"),
14994
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = System;"),
14997
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using O = System.Object;"),
15000
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using O = System.Object;"));
15043
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(15, 5),
15046
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using ns = namespace2;").WithLocation(14, 5));
15064
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System;"),
15067
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = ABC.X<int>;"));
16913
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
16916
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
16919
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"),
16922
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Goo.Bar;"));
17864
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
20129
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using A = A;").WithLocation(1, 1),
20132
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using B;").WithLocation(4, 5));
21313
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using one = System.Console;").WithLocation(2, 1),
21319
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @two = System.Console;").WithLocation(3, 1),
21322
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using three = System;").WithLocation(4, 1),
21328
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Ten = System.Console;").WithLocation(5, 1),
21331
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using cédille = System.Console;").WithLocation(6, 1)
21341
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using one = System.Console;").WithLocation(2, 1),
21344
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using @two = System.Console;").WithLocation(3, 1),
21347
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using three = System;").WithLocation(4, 1),
21350
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Ten = System.Console;").WithLocation(5, 1),
21353
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using cédille = System.Console;").WithLocation(6, 1)
Symbols\TypeTests.cs (2)
713
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
750
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (48)
Parsing\ParserErrorMessageTests.cs (6)
1924
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1));
2183
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(2, 1));
2819
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(2, 1));
5473
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using N1Alias = N1;").WithLocation(2, 1),
5476
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;").WithLocation(1, 1));
5935
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using global = MyClass;").WithLocation(2, 1));
Parsing\UsingDirectiveParsingTests.cs (36)
363
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static x = ref int;").WithLocation(1, 1),
618
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = A*;").WithLocation(1, 1),
672
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe x = A*;").WithLocation(1, 1),
722
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = delegate*<int, void>;").WithLocation(1, 1),
784
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe x = delegate*<int, void>;").WithLocation(1, 1),
844
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe System;").WithLocation(1, 1),
875
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using static unsafe System.Console;").WithLocation(1, 1),
914
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = int;").WithLocation(1, 1),
954
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = int;").WithLocation(1, 1),
991
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = int;").WithLocation(1, 1),
1028
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = ref int;").WithLocation(1, 1),
1072
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = ref readonly int;").WithLocation(1, 1),
1117
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = int*;").WithLocation(1, 1),
1161
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe x = int*;").WithLocation(1, 1),
1209
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = X;").WithLocation(6, 5),
1284
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe Y = X;").WithLocation(6, 5));
1360
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe Y = X;").WithLocation(6, 5));
1432
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = X[];").WithLocation(6, 5),
1519
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using unsafe Y = X[];").WithLocation(6, 5));
1598
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = (int, int);").WithLocation(1, 1),
1860
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = int?;").WithLocation(1, 1),
1901
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using x = string?;").WithLocation(1, 1),
1951
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = string?;").WithLocation(2, 1),
1998
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = X?;").WithLocation(4, 5),
2076
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using Y = X?;").WithLocation(5, 5),
2601
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using dynamic;").WithLocation(2, 1),
3200
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int?;").WithLocation(1, 1),
3203
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System;").WithLocation(2, 1),
3264
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int?;").WithLocation(1, 1),
3267
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int;").WithLocation(2, 1),
3328
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int?;").WithLocation(1, 1),
3331
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = System.Int32;").WithLocation(2, 1),
3401
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int?;").WithLocation(1, 1),
3404
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = int;").WithLocation(3, 1));
4002
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = __arglist;").WithLocation(2, 1),
4047
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using X = __makeref;").WithLocation(2, 1),
Syntax\SyntaxTreeTests.cs (6)
370
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using ns1;").WithLocation(1, 1),
442
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using ns1;").WithLocation(1, 16),
512
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static ns1;").WithLocation(1, 1),
586
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using static ns1;").WithLocation(1, 16),
664
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias = ns1;").WithLocation(1, 1),
755
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "global using alias = ns1;").WithLocation(1, 16),
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
1290
if (!compileDiagnostics.Any(d => d.Code == (int)ErrorCode.HDN_UnusedExternAlias || d.Code == (int)ErrorCode.
HDN_UnusedUsingDirective
))
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (71)
CodeGen\WinRTCollectionTests.cs (71)
442
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
445
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
448
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
1470
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
1473
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
1476
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
1840
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
1843
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
1846
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
3200
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
3203
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
3206
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
4443
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
4446
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
4449
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
4809
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
4812
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
4815
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
4996
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
4999
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
5002
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
5194
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
5197
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
5200
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"));
5413
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
5416
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
5419
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
5422
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
5550
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
5553
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
5556
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
5559
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
5704
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;").WithLocation(2, 1),
5707
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Threading;").WithLocation(4, 1),
5710
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Runtime.InteropServices;").WithLocation(3, 1));
5820
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
5823
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
5826
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
5829
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
6047
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
6050
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
6053
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
6056
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"),
6059
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"));
6246
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
6249
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
6252
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
6605
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
6608
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
6611
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
6614
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
6766
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
6769
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
6772
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
6775
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"));
7038
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
7041
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
7044
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
7047
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"),
7050
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"));
7165
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
7168
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
7171
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
7174
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"),
7177
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"));
7286
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections.Generic;"),
7289
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Reflection;"),
7292
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq.Expressions;"),
7295
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Linq;"),
7298
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System.Collections;"));
7390
Diagnostic(ErrorCode.
HDN_UnusedUsingDirective
, "using System;"));