197 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)
2888comp = 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 (56)
Semantics\InterceptorsTests.cs (2)
73var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: RegularWithInterceptors, options: TestOptions.DebugExe.WithWarningLevel(8)); 76comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: RegularWithInterceptors, options: TestOptions.DebugExe.WithWarningLevel(9));
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( 18384CreateCompilation(source, options: TestOptions.DebugExe.WithWarningLevel(5)).VerifyDiagnostics(); 21082this.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)
637option = commonoption.WithWarningLevel(3); 646option = commonoption.WithWarningLevel(2); 649option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 652option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 687option = commonoption.WithWarningLevel(3); 693option = commonoption.WithWarningLevel(2); 696option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 699option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 741option = commonoption.WithWarningLevel(3); 750option = commonoption.WithWarningLevel(2); 753option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 756option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 797option = commonoption.WithWarningLevel(3); 806option = commonoption.WithWarningLevel(2); 809option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 812option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 853option = commonoption.WithWarningLevel(3); 862option = commonoption.WithWarningLevel(2); 865option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 868option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 911option = commonoption.WithWarningLevel(3); 920option = commonoption.WithWarningLevel(2); 923option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 926option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 969option = commonoption.WithWarningLevel(3); 978option = commonoption.WithWarningLevel(2); 981option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 984option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1031option = commonoption.WithWarningLevel(3); 1043option = commonoption.WithWarningLevel(2); 1046option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1049option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1104option = commonoption.WithWarningLevel(3); 1119option = commonoption.WithWarningLevel(2); 1122option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1125option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1172option = commonoption.WithWarningLevel(3); 1184option = commonoption.WithWarningLevel(2); 1187option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1190option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1231option = commonoption.WithWarningLevel(3); 1237option = commonoption.WithWarningLevel(2); 1240option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1243option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1284option = commonoption.WithWarningLevel(3); 1290option = commonoption.WithWarningLevel(2); 1293option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1296option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1338option = commonoption.WithWarningLevel(3); 1344option = commonoption.WithWarningLevel(2); 1347option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1350option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1385option = commonoption.WithWarningLevel(3); 1388option = commonoption.WithWarningLevel(2); 1391option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1394option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1439option = commonoption.WithWarningLevel(3); 1445option = commonoption.WithWarningLevel(2); 1448option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1451option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1518option = commonoption.WithWarningLevel(2); 1568option = commonoption.WithWarningLevel(2); 1621option = commonoption.WithWarningLevel(2); 1674option = commonoption.WithWarningLevel(2); 1718option = commonoption.WithWarningLevel(2); 1749option = commonoption.WithWarningLevel(2); 1795option = commonoption.WithWarningLevel(2); 1850option = commonoption.WithWarningLevel(2); 2283option = commonoption.WithWarningLevel(2);
Microsoft.VisualStudio.LanguageServices.CSharp (1)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
150.WithWarningLevel(warningLevel);