143 references to WithWarningAsError
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
11318
.
WithWarningAsError
(true));
11343
.
WithWarningAsError
(false));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Emit\CompilationEmitTests.cs (2)
5610
Diagnostic(ErrorCode.WRN_UnreferencedField, "_f").WithArguments("X._f").WithLocation(4, 9).
WithWarningAsError
(true));
5655
Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "Y").WithArguments("Y").WithLocation(4, 19).
WithWarningAsError
(true));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (87)
Attributes\AttributeTests_WellKnownAttributes.cs (2)
8796
Diagnostic("TEST1", "M1()", isSuppressed: false).WithArguments("C1.M1()").WithLocation(6, 9).
WithWarningAsError
(true)
8816
Diagnostic("TEST1", "M1()", isSuppressed: false).WithArguments("C1.M1()").WithLocation(6, 9).
WithWarningAsError
(true)
Diagnostics\DiagnosticAnalyzerTests.cs (11)
177
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x1").WithArguments("x1").
WithWarningAsError
(true),
180
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x2").WithArguments("x2").
WithWarningAsError
(true),
183
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x3").WithArguments("x3").
WithWarningAsError
(true)
210
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x1").WithArguments("x1").
WithWarningAsError
(true),
213
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x2").WithArguments("x2").
WithWarningAsError
(true),
216
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x3").WithArguments("x3").
WithWarningAsError
(true));
292
Diagnostic("XX0001", "C").WithArguments("NamedType").
WithWarningAsError
(true),
294
Diagnostic("XX0001", "using System;").WithArguments("UsingDirective").
WithWarningAsError
(true), // using directive
295
Diagnostic("XX0001", "Obsolete").WithArguments("Attribute").
WithWarningAsError
(true), // attribute syntax
297
public class C { }").WithArguments("ClassDeclaration").
WithWarningAsError
(true)); // class declaration
1836
builder[i] = builder[i].
WithWarningAsError
(true);
Diagnostics\DiagnosticSuppressorTests.cs (2)
350
diagnostic = diagnostic.
WithWarningAsError
(true);
351
diagnosticNoSuppressor = diagnosticNoSuppressor.
WithWarningAsError
(true);
Semantics\ExperimentalAttributeTests.cs (72)
62
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
114
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
117
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
179
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
182
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
225
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
288
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
291
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
329
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
378
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
381
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
436
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
439
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
506
Diagnostic("DiagModule", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
509
Diagnostic("DiagModule", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
628
Diagnostic("DiagType", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
631
Diagnostic("DiagMethod", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
698
Diagnostic("DiagType", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
701
Diagnostic("DiagAssembly", "C.Nested").WithArguments("C.Nested").WithLocation(1, 1).
WithWarningAsError
(true),
704
Diagnostic("DiagAssembly", "C.Nested.M()").WithArguments("C.Nested.M()").WithLocation(1, 1).
WithWarningAsError
(true)
739
Diagnostic("Diag", "base.M()").WithArguments("C.M()").WithLocation(7, 9).
WithWarningAsError
(true),
742
Diagnostic("Diag", "M()").WithArguments("C.M()").WithLocation(8, 9).
WithWarningAsError
(true)
786
Diagnostic("Diag", "base.M()").WithArguments("Derived.M()").WithLocation(17, 9).
WithWarningAsError
(true)
830
Diagnostic("Diag", "public class Derived : C { public override void M() { } }").WithArguments("C.C()").WithLocation(1, 1).
WithWarningAsError
(true),
833
Diagnostic("Diag", "C").WithArguments("C").WithLocation(1, 24).
WithWarningAsError
(true)
942
Diagnostic("DiagID1", "new Derived()").WithArguments("Derived.Derived()").WithLocation(1, 5).
WithWarningAsError
(true),
945
Diagnostic("DiagID1", "Derived").WithArguments("Derived").WithLocation(1, 9).
WithWarningAsError
(true)
1007
Diagnostic("DiagID1", "new Derived()").WithArguments("Derived.Derived()").WithLocation(1, 5).
WithWarningAsError
(true),
1010
Diagnostic("DiagID1", "Derived").WithArguments("Derived").WithLocation(1, 9).
WithWarningAsError
(true)
1069
Diagnostic("DiagID1", "S").WithArguments("S").WithLocation(1, 1).
WithWarningAsError
(true)
1098
Diagnostic("DiagID1", "E").WithArguments("E").WithLocation(1, 1).
WithWarningAsError
(true)
1129
Diagnostic("DiagID1", "new C()").WithArguments("C.C()").WithLocation(1, 5).
WithWarningAsError
(true)
1160
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(1, 1).
WithWarningAsError
(true)
1191
Diagnostic("DiagID1", "C.P").WithArguments("C.P").WithLocation(1, 5).
WithWarningAsError
(true)
1222
Diagnostic("DiagID1", "C.field").WithArguments("C.field").WithLocation(1, 5).
WithWarningAsError
(true)
1253
Diagnostic("DiagID1", "C.Event").WithArguments("C.Event").WithLocation(1, 1).
WithWarningAsError
(true)
1280
Diagnostic("DiagID1", "I").WithArguments("I").WithLocation(1, 1).
WithWarningAsError
(true)
1304
Diagnostic("DiagID1", "D").WithArguments("D").WithLocation(1, 1).
WithWarningAsError
(true)
1392
Diagnostic(ErrorCode.WRN_Experimental, "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
1480
Diagnostic("Diag\n", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
1506
Diagnostic("Diag\n", "C").WithArguments("C").WithLocation(2, 1).
WithWarningAsError
(true),
1530
Diagnostic("Diag\n01", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
1557
Diagnostic(ErrorCode.WRN_Experimental, "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
1603
Diagnostic("Diag 01", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true),
1667
Diagnostic("Diag 01", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
1682
Diagnostic("Diag 01", "C").WithArguments("C").WithLocation(3, 1).
WithWarningAsError
(true)
1714
Diagnostic(ErrorCode.WRN_Experimental, "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
1810
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
1851
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
1890
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
1931
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
1972
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2011
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2052
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2091
Diagnostic("DiagID", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2117
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2143
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2169
Diagnostic("DiagID1", "C").WithArguments("C", "use CCC instead").WithLocation(1, 1).
WithWarningAsError
(true)
2195
Diagnostic("DiagID1", "C").WithArguments("C", "use CCC instead").WithLocation(1, 1).
WithWarningAsError
(true)
2221
Diagnostic("DiagID1", "C").WithArguments("C", "use CC instead").WithLocation(1, 1).
WithWarningAsError
(true)
2247
Diagnostic("DiagID1", "C").WithArguments("C", "use CC instead").WithLocation(1, 1).
WithWarningAsError
(true)
2273
Diagnostic("DiagID1", "C").WithArguments("C", "use CC instead").WithLocation(1, 1).
WithWarningAsError
(true)
2299
Diagnostic("DiagID1", "C").WithArguments("C", "use CC instead").WithLocation(1, 1).
WithWarningAsError
(true)
2325
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2356
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2387
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2413
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2439
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2464
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2489
Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(1, 1).
WithWarningAsError
(true)
2517
Diagnostic("DiagID1", "N.C").WithArguments("N.C").WithLocation(1, 1).
WithWarningAsError
(true)
2574
Diagnostic("DiagID1", "C.M()").WithArguments("C.M()").WithLocation(6, 9).
WithWarningAsError
(true)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (10)
Semantics\NullableReferenceTypesTests.cs (6)
125211
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
125222
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
125232
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
125546
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
125557
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
125567
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
Semantics\StructConstructorTests.cs (1)
3905
Diagnostic(ErrorCode.WRN_UnassignedThisSupportedVersion, "S").WithArguments("S.x").WithLocation(5, 12).
WithWarningAsError
(true));
Semantics\UninitializedNonNullableFieldTests.cs (1)
2806
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "f").WithArguments("field", "f").WithLocation(8, 14).
WithWarningAsError
(warnAsError));
SourceGeneration\GeneratorDriverTests.cs (2)
1194
Diagnostic("GEN001").WithLocation(1, 1).
WithWarningAsError
(true),
1199
Diagnostic("GEN002").WithLocation(1, 1).
WithWarningAsError
(true));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Compilation\CompilationAPITests.cs (2)
158
Diagnostic(ErrorCode.WRN_LowercaseEllSuffix, "l").WithLocation(1, 22).
WithWarningAsError
(true));
177
Diagnostic(ErrorCode.WRN_LowercaseEllSuffix, "l").WithLocation(1, 23).
WithWarningAsError
(true),
Compilation\GetUnusedImportDirectivesTests.cs (1)
383
Diagnostic(ErrorCode.HDN_UnusedUsingDirective, "using System;").
WithWarningAsError
(false));
DocumentationComments\DocumentationCommentCompilerTests.cs (1)
8175
Diagnostic(ErrorCode.WRN_MissingXMLComment, "C").WithArguments("C").
WithWarningAsError
(true));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (33)
Diagnostics\DiagnosticTest.cs (33)
584
Diagnostic(ErrorCode.WRN_VolatileByRef, "i").WithArguments("C.i").
WithWarningAsError
(true));
591
Diagnostic(ErrorCode.WRN_VolatileByRef, "i").WithArguments("C.i").
WithWarningAsError
(true));
632
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
685
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
736
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
795
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
851
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
906
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
964
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1023
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").WithLocation(7, 13).
WithWarningAsError
(true),
1029
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").WithLocation(10, 13).
WithWarningAsError
(true));
1093
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").WithLocation(7, 13).
WithWarningAsError
(true),
1099
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").WithLocation(10, 13).
WithWarningAsError
(true),
1102
Diagnostic(ErrorCode.WRN_UnreferencedVar, "w").WithArguments("w").WithLocation(12, 13).
WithWarningAsError
(true));
1164
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").WithLocation(7, 13).
WithWarningAsError
(true),
1170
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").WithLocation(10, 13).
WithWarningAsError
(true));
1229
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1282
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1336
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1437
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1496
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1502
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1560
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1566
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1613
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1619
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1666
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1672
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1716
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1783
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1835
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
2265
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
2268
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\DiagnosticExtensions.cs (1)
254
newExpected = expected.
WithWarningAsError
(!expected.IsWarningAsError);
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (4)
Parser\ParseDirectives.vb (4)
3224
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))
3233
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))
3331
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))
3340
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))