115 references to WithWarningAsError
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
11062
.
WithWarningAsError
(true));
11087
.
WithWarningAsError
(false));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Emit\CompilationEmitTests.cs (2)
5604
Diagnostic(ErrorCode.WRN_UnreferencedField, "_f").WithArguments("X._f").WithLocation(4, 9).
WithWarningAsError
(true));
5649
Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "Y").WithArguments("Y").WithLocation(4, 19).
WithWarningAsError
(true));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (15)
Attributes\AttributeTests_WellKnownAttributes.cs (2)
8710
Diagnostic("TEST1", "M1()", isSuppressed: false).WithArguments("C1.M1()").WithLocation(6, 9).
WithWarningAsError
(true)
8730
Diagnostic("TEST1", "M1()", isSuppressed: false).WithArguments("C1.M1()").WithLocation(6, 9).
WithWarningAsError
(true)
Diagnostics\DiagnosticAnalyzerTests.cs (11)
176
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x1").WithArguments("x1").
WithWarningAsError
(true),
179
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x2").WithArguments("x2").
WithWarningAsError
(true),
182
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x3").WithArguments("x3").
WithWarningAsError
(true)
209
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x1").WithArguments("x1").
WithWarningAsError
(true),
212
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x2").WithArguments("x2").
WithWarningAsError
(true),
215
Diagnostic("CA9999_UseOfVariableThatStartsWithX", "x3").WithArguments("x3").
WithWarningAsError
(true));
291
Diagnostic("XX0001", "C").WithArguments("NamedType").
WithWarningAsError
(true),
293
Diagnostic("XX0001", "using System;").WithArguments("UsingDirective").
WithWarningAsError
(true), // using directive
294
Diagnostic("XX0001", "Obsolete").WithArguments("Attribute").
WithWarningAsError
(true), // attribute syntax
296
public class C { }").WithArguments("ClassDeclaration").
WithWarningAsError
(true)); // class declaration
1835
builder[i] = builder[i].
WithWarningAsError
(true);
Diagnostics\DiagnosticSuppressorTests.cs (2)
262
diagnostic = diagnostic.
WithWarningAsError
(true);
263
diagnosticNoSuppressor = diagnosticNoSuppressor.
WithWarningAsError
(true);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (10)
Semantics\NullableReferenceTypesTests.cs (6)
121441
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
121452
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
121462
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
121776
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
121787
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").
WithWarningAsError
(true)
121797
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)
2803
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)
160
Diagnostic(ErrorCode.WRN_LowercaseEllSuffix, "l").WithLocation(1, 22).
WithWarningAsError
(true));
179
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)
6430
Diagnostic(ErrorCode.WRN_MissingXMLComment, "C").WithArguments("C").
WithWarningAsError
(true));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (33)
Diagnostics\DiagnosticTest.cs (33)
546
Diagnostic(ErrorCode.WRN_VolatileByRef, "i").WithArguments("C.i").
WithWarningAsError
(true));
553
Diagnostic(ErrorCode.WRN_VolatileByRef, "i").WithArguments("C.i").
WithWarningAsError
(true));
594
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
647
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
698
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
757
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
813
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
868
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
926
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
985
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").WithLocation(7, 13).
WithWarningAsError
(true),
991
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").WithLocation(10, 13).
WithWarningAsError
(true));
1055
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").WithLocation(7, 13).
WithWarningAsError
(true),
1061
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").WithLocation(10, 13).
WithWarningAsError
(true),
1064
Diagnostic(ErrorCode.WRN_UnreferencedVar, "w").WithArguments("w").WithLocation(12, 13).
WithWarningAsError
(true));
1126
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").WithLocation(7, 13).
WithWarningAsError
(true),
1132
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").WithLocation(10, 13).
WithWarningAsError
(true));
1191
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1244
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1298
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1399
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1458
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1464
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1522
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1528
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1575
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1581
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1628
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1634
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1678
Diagnostic(ErrorCode.WRN_UnreferencedVar, "z").WithArguments("z").
WithWarningAsError
(true));
1745
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
1797
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
2227
Diagnostic(ErrorCode.WRN_UnreferencedVar, "x").WithArguments("x").
WithWarningAsError
(true),
2230
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.Semantic.UnitTests (12)
Compilation\VisualBasicCompilationOptionsTests.vb (9)
455
Diagnostic(ERRID.WRN_UnusedLocal, "x").WithArguments("x").
WithWarningAsError
(True),
456
Diagnostic(ERRID.WRN_UnusedLocal, "y").WithArguments("y").
WithWarningAsError
(True),
457
Diagnostic(ERRID.WRN_UnusedLocalConst, "z").WithArguments("z").
WithWarningAsError
(True),
458
Diagnostic(ERRID.WRN_DefAsgNoRetValFuncRef1, "End Function").WithArguments("goo").
WithWarningAsError
(True))
470
Diagnostic(ERRID.WRN_DefAsgNoRetValFuncRef1, "End Function").WithArguments("goo").
WithWarningAsError
(True))
482
Diagnostic(ERRID.WRN_UnusedLocalConst, "z").WithArguments("z").
WithWarningAsError
(True),
483
Diagnostic(ERRID.WRN_DefAsgNoRetValFuncRef1, "End Function").WithArguments("goo").
WithWarningAsError
(True))
492
Diagnostic(ERRID.WRN_UnusedLocalConst, "z").WithArguments("z").
WithWarningAsError
(True),
493
Diagnostic(ERRID.WRN_DefAsgNoRetValFuncRef1, "End Function").WithArguments("goo").
WithWarningAsError
(True))
Diagnostics\DiagnosticAnalyzerTests.vb (1)
1294
builder(i) = builder(i).
WithWarningAsError
(True)
SourceGeneration\GeneratorDriverTests.vb (2)
213
Diagnostic("GEN001").WithLocation(1, 1).
WithWarningAsError
(True),
220
Diagnostic("GEN002").WithLocation(1, 1).
WithWarningAsError
(True))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (36)
Parser\ParseDirectives.vb (36)
2789
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
2798
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
2829
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
2838
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
2869
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
2878
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
2909
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
2918
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
2949
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(4, 13).
WithWarningAsError
(True),
2951
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
2961
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(4, 13).
WithWarningAsError
(True),
2962
Diagnostic(ERRID.WRN_DefAsgUseNullRef, "b").WithArguments("b").WithLocation(6, 17).
WithWarningAsError
(True),
2963
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
2994
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(4, 13).
WithWarningAsError
(True),
2996
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
3006
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(4, 13).
WithWarningAsError
(True),
3007
Diagnostic(ERRID.WRN_DefAsgUseNullRef, "b").WithArguments("b").WithLocation(6, 17).
WithWarningAsError
(True),
3008
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
3040
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(5, 13).
WithWarningAsError
(True),
3051
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(5, 13).
WithWarningAsError
(True),
3052
Diagnostic(ERRID.WRN_DefAsgUseNullRef, "b").WithArguments("b").WithLocation(7, 17).
WithWarningAsError
(True))
3084
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
3094
Diagnostic(ERRID.WRN_DefAsgUseNullRef, "b").WithArguments("b").WithLocation(6, 17).
WithWarningAsError
(True),
3095
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(8, 13).
WithWarningAsError
(True))
3132
Diagnostic(ERRID.WRN_UnusedLocal, "f").WithArguments("f").WithLocation(10, 13).
WithWarningAsError
(True),
3143
Diagnostic(ERRID.WRN_UnusedLocal, "f").WithArguments("f").WithLocation(10, 13).
WithWarningAsError
(True),
3144
Diagnostic(ERRID.WRN_DefAsgUseNullRef, "g").WithArguments("g").WithLocation(13, 17).
WithWarningAsError
(True))
3222
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))
3231
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))
3264
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(5, 13).
WithWarningAsError
(True),
3266
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
3276
Diagnostic(ERRID.WRN_UnusedLocal, "a").WithArguments("a").WithLocation(5, 13).
WithWarningAsError
(True),
3277
Diagnostic(ERRID.WRN_DefAsgUseNullRef, "b").WithArguments("b").WithLocation(7, 17).
WithWarningAsError
(True),
3278
Diagnostic(ERRID.WRN_UnusedLocal, "d").WithArguments("d").WithLocation(9, 13).
WithWarningAsError
(True))
3329
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))
3338
New Test.Utilities.DiagnosticDescription(expectedId, "As Long", Nothing, Nothing, Nothing, False, GetType(String)).WithLocation(10, 15).
WithWarningAsError
(True))