195 references to WithWarningLevel
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (1)
src\Analyzers\CSharp\Tests\RemoveUnnecessaryImports\RemoveUnnecessaryImportsTests.cs (1)
2065return solution.WithProjectCompilationOptions(projectId, compilationOptions.WithWarningLevel(warningLevel));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (6)
CodeGen\CodeGenAsyncTests.cs (1)
1067CreateCompilation(source, options: TestOptions.UnsafeDebugExe.WithWarningLevel(7)).VerifyDiagnostics(
CodeGen\CodeGenLocalFunctionTests.cs (2)
2439VerifyOutput(source, "2", TestOptions.ReleaseExe.WithWarningLevel(0)); 4609VerifyOutput(source, output, TestOptions.ReleaseExe.WithAllowUnsafe(true).WithWarningLevel(0), verify: Verification.Passes);
CodeGen\CodeGenOperators.cs (1)
2290CompileAndVerify(source, expectedOutput: "0", options: TestOptions.ReleaseExe.WithWarningLevel(5)).VerifyDiagnostics(
CodeGen\CodeGenOptimizedNullableOperators.cs (1)
1406CompileAndVerify(source, expectedOutput: expectedOutput, options: TestOptions.ReleaseExe.WithWarningLevel(4)).VerifyDiagnostics(
Emit\EntryPointTests.cs (1)
18return CreateCompilation(source, options: TestOptions.ReleaseExe.WithWarningLevel(5).WithMainTypeName(mainTypeName), parseOptions: parseOptions);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Emit\NumericIntPtrTests.cs (2)
1021var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net70); 1024comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net70);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Attributes\AttributeTests_CallerInfoAttributes.cs (1)
3323CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseDll.WithWarningLevel(0)).VerifyDiagnostics(
Attributes\AttributeTests_MarshalAs.cs (2)
704options: TestOptions.ReleaseDll.WithWarningLevel(7)) 709options: TestOptions.ReleaseDll.WithWarningLevel(8))
Attributes\AttributeTests_NativeInteger.cs (1)
1421comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.Regular9);
FlowAnalysis\StructTests.cs (16)
560options: TestOptions.ReleaseDll.WithWarningLevel(5), 570options: TestOptions.ReleaseDll.WithWarningLevel(5), 580options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 587options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 649CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 651CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 653CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 658CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 694CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 696CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 698CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 703CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 738CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 786CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: WithNullableEnable().WithWarningLevel(5)).VerifyDiagnostics( 814CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 816CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(
Semantics\RecordTests.cs (1)
2818comp = CreateCompilation(src, parseOptions: TestOptions.Regular8, options: TestOptions.ReleaseDll.WithWarningLevel(6));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
src\Analyzers\CSharp\Tests\RemoveUnnecessaryImports\RemoveUnnecessaryImportsTests.cs (1)
2065return solution.WithProjectCompilationOptions(projectId, compilationOptions.WithWarningLevel(warningLevel));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (54)
Semantics\NameOfTests.cs (2)
240var option = TestOptions.ReleaseExe.WithWarningLevel(0); 420var option = TestOptions.ReleaseExe.WithWarningLevel(0);
Semantics\NativeIntegerTests.cs (2)
3489var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.Regular9); 3492comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.Regular9);
Semantics\NullableConversionTests.cs (1)
653var compilation = CreateCompilation(source, options: TestOptions.ReleaseExe.WithWarningLevel(0));
Semantics\RefFieldTests.cs (2)
5484CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(9), targetFramework: TargetFramework.Net70).VerifyDiagnostics(); 5493CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(10), targetFramework: TargetFramework.Net70).VerifyDiagnostics(expectedDiagnostics);
Semantics\SemanticErrorTests.cs (3)
12810CreateCompilation(text, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 18393CreateCompilation(source, options: TestOptions.DebugExe.WithWarningLevel(5)).VerifyDiagnostics(); 21091this.CompileAndVerify(source: text, expectedOutput: expected, options: TestOptions.ReleaseExe.WithWarningLevel(4)).VerifyDiagnostics(compatibleExpected);
Semantics\WarningVersionTests.cs (41)
48CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics(); 49CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(3)).VerifyDiagnostics(); 50CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)).VerifyDiagnostics(); 51CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(whenWave5); 52CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)).VerifyDiagnostics(whenWave5); 78CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics(); 79CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)).VerifyDiagnostics(); 80CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(whenWave5); 117CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics(); 118CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)).VerifyDiagnostics(); 119CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(whenWave5); 157options: TestOptions.DebugDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 166options: TestOptions.DebugDll.WithWarningLevel(5), 179options: TestOptions.DebugDll.WithWarningLevel(5), 189.WithWarningLevel(5) 235options: TestOptions.DebugDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 244options: TestOptions.DebugDll.WithWarningLevel(5), 258.WithWarningLevel(5), 268.WithWarningLevel(5) 321options: TestOptions.DebugDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 330options: TestOptions.DebugDll.WithWarningLevel(5), 346options: TestOptions.DebugDll.WithWarningLevel(5), 359.WithWarningLevel(5) 392CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 394CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 445options: TestOptions.DebugDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 454options: TestOptions.DebugDll.WithWarningLevel(5), 467options: TestOptions.DebugDll.WithWarningLevel(5), 477.WithWarningLevel(5) 532options: TestOptions.DebugDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 541options: TestOptions.DebugDll.WithWarningLevel(5), 554options: TestOptions.DebugDll.WithWarningLevel(5), 564.WithWarningLevel(5) 619options: TestOptions.DebugDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel), 628options: TestOptions.DebugDll.WithWarningLevel(5), 641options: TestOptions.DebugDll.WithWarningLevel(5), 651.WithWarningLevel(5) 683CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 685CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 713CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 715CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(
SourceGeneration\GeneratorDriverTests.cs (3)
1183verifyDiagnosticsWithOptions(options.WithWarningLevel(0)); 1185verifyDiagnosticsWithOptions(options.WithWarningLevel(2), 1188verifyDiagnosticsWithOptions(options.WithWarningLevel(3),
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (40)
Compilation\CompilationAPITests.cs (2)
230CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(0)).VerifyDiagnostics( 288var compilationOptions = TestOptions.DebugDll.WithWarningLevel(0);
Compilation\CSharpCompilationOptionsTests.cs (5)
123TestProperty((old, value) => old.WithWarningLevel(value), opt => opt.WarningLevel, 3); 239Assert.Equal(1, new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithWarningLevel(1).WarningLevel); 240new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithWarningLevel(-1).VerifyErrors( 244new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithWarningLevel(5).VerifyErrors(); 245new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithWarningLevel(int.MaxValue).VerifyErrors();
Compilation\GetUnusedImportDirectivesTests.cs (2)
291comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(3)); 317var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(0));
Symbols\ExtendedPartialMethodsTests.cs (20)
2726var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 2732comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 2770var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 2773comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 2798var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 2807comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3102var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3105comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3129var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3132comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3210var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3234comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3317var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3320comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)); 3355var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3373comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)); 3416var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3419comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)); 3457var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3460comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6));
Symbols\SymbolErrorTests.cs (11)
13378var regularComp = CreateCompilation(text, options: TestOptions.ReleaseDll.WithWarningLevel(4)); 13804comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)); 21336comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(6)); 21339comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21397comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(6)); 21400comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21442comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(6)); 21461comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21484var comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21502comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21529comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (69)
Diagnostics\DiagnosticTest.cs (69)
634option = commonoption.WithWarningLevel(3); 643option = commonoption.WithWarningLevel(2); 646option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 649option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 684option = commonoption.WithWarningLevel(3); 690option = commonoption.WithWarningLevel(2); 693option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 696option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 738option = commonoption.WithWarningLevel(3); 747option = commonoption.WithWarningLevel(2); 750option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 753option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 794option = commonoption.WithWarningLevel(3); 803option = commonoption.WithWarningLevel(2); 806option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 809option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 850option = commonoption.WithWarningLevel(3); 859option = commonoption.WithWarningLevel(2); 862option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 865option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 908option = commonoption.WithWarningLevel(3); 917option = commonoption.WithWarningLevel(2); 920option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 923option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 966option = commonoption.WithWarningLevel(3); 975option = commonoption.WithWarningLevel(2); 978option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 981option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1028option = commonoption.WithWarningLevel(3); 1040option = commonoption.WithWarningLevel(2); 1043option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1046option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1101option = commonoption.WithWarningLevel(3); 1116option = commonoption.WithWarningLevel(2); 1119option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1122option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1169option = commonoption.WithWarningLevel(3); 1181option = commonoption.WithWarningLevel(2); 1184option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1187option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1228option = commonoption.WithWarningLevel(3); 1234option = commonoption.WithWarningLevel(2); 1237option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1240option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1281option = commonoption.WithWarningLevel(3); 1287option = commonoption.WithWarningLevel(2); 1290option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1293option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1335option = commonoption.WithWarningLevel(3); 1341option = commonoption.WithWarningLevel(2); 1344option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1347option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1382option = commonoption.WithWarningLevel(3); 1385option = commonoption.WithWarningLevel(2); 1388option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1391option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1436option = commonoption.WithWarningLevel(3); 1442option = commonoption.WithWarningLevel(2); 1445option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1448option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1515option = commonoption.WithWarningLevel(2); 1565option = commonoption.WithWarningLevel(2); 1618option = commonoption.WithWarningLevel(2); 1671option = commonoption.WithWarningLevel(2); 1715option = commonoption.WithWarningLevel(2); 1746option = commonoption.WithWarningLevel(2); 1792option = commonoption.WithWarningLevel(2); 1847option = commonoption.WithWarningLevel(2); 2280option = commonoption.WithWarningLevel(2);
Microsoft.VisualStudio.LanguageServices.CSharp (1)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
150.WithWarningLevel(warningLevel);