197 references to WithWarningLevel
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (1)
src\Analyzers\CSharp\Tests\RemoveUnnecessaryImports\RemoveUnnecessaryImportsTests.cs (1)
1974return solution.WithProjectCompilationOptions(projectId, compilationOptions.WithWarningLevel(warningLevel));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (6)
CodeGen\CodeGenAsyncTests.cs (1)
2173CreateCompilation(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)
1027var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net70); 1030comp = 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)
1423comp = 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)
2878comp = CreateCompilation(src, parseOptions: TestOptions.Regular8, options: TestOptions.ReleaseDll.WithWarningLevel(6));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
src\Analyzers\CSharp\Tests\RemoveUnnecessaryImports\RemoveUnnecessaryImportsTests.cs (1)
1974return solution.WithProjectCompilationOptions(projectId, compilationOptions.WithWarningLevel(warningLevel));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (56)
Semantics\InterceptorsTests.cs (2)
74var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: RegularWithInterceptors, options: TestOptions.DebugExe.WithWarningLevel(8)); 77comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: RegularWithInterceptors, options: TestOptions.DebugExe.WithWarningLevel(9));
Semantics\NameOfTests.cs (2)
241var option = TestOptions.ReleaseExe.WithWarningLevel(0); 421var option = TestOptions.ReleaseExe.WithWarningLevel(0);
Semantics\NativeIntegerTests.cs (2)
3494var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.Regular9); 3497comp = 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)
5546CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(9), targetFramework: TargetFramework.Net70).VerifyDiagnostics(); 5555CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(10), targetFramework: TargetFramework.Net70).VerifyDiagnostics(expectedDiagnostics);
Semantics\SemanticErrorTests.cs (3)
12855CreateCompilation(text, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 18494CreateCompilation(source, options: TestOptions.DebugExe.WithWarningLevel(5)).VerifyDiagnostics(); 21192this.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)
229CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(0)).VerifyDiagnostics( 287var 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)
3050var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3056comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3094var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3097comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3122var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3131comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3426var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3429comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3453var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3456comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3534var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3558comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6), parseOptions: TestOptions.RegularWithExtendedPartialMethods); 3641var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3644comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)); 3679var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3697comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)); 3740var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3743comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6)); 3781var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)); 3784comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(6));
Symbols\SymbolErrorTests.cs (11)
13442var regularComp = CreateCompilation(text, options: TestOptions.ReleaseDll.WithWarningLevel(4)); 13868comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)); 21400comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(6)); 21403comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21461comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(6)); 21464comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21506comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(6)); 21525comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21548var comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21566comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7)); 21593comp = CreateCompilation(text, parseOptions: TestOptions.Regular11, options: TestOptions.DebugDll.WithWarningLevel(7));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (69)
Diagnostics\DiagnosticTest.cs (69)
636option = commonoption.WithWarningLevel(3); 645option = commonoption.WithWarningLevel(2); 648option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 651option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 686option = commonoption.WithWarningLevel(3); 692option = commonoption.WithWarningLevel(2); 695option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 698option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 740option = commonoption.WithWarningLevel(3); 749option = commonoption.WithWarningLevel(2); 752option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 755option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 796option = commonoption.WithWarningLevel(3); 805option = commonoption.WithWarningLevel(2); 808option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 811option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 852option = commonoption.WithWarningLevel(3); 861option = commonoption.WithWarningLevel(2); 864option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 867option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 910option = commonoption.WithWarningLevel(3); 919option = commonoption.WithWarningLevel(2); 922option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 925option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 968option = commonoption.WithWarningLevel(3); 977option = commonoption.WithWarningLevel(2); 980option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 983option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1030option = commonoption.WithWarningLevel(3); 1042option = commonoption.WithWarningLevel(2); 1045option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1048option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1103option = commonoption.WithWarningLevel(3); 1118option = commonoption.WithWarningLevel(2); 1121option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1124option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1171option = commonoption.WithWarningLevel(3); 1183option = commonoption.WithWarningLevel(2); 1186option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1189option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1230option = commonoption.WithWarningLevel(3); 1236option = commonoption.WithWarningLevel(2); 1239option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1242option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1283option = commonoption.WithWarningLevel(3); 1289option = commonoption.WithWarningLevel(2); 1292option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1295option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1337option = commonoption.WithWarningLevel(3); 1343option = commonoption.WithWarningLevel(2); 1346option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1349option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1384option = commonoption.WithWarningLevel(3); 1387option = commonoption.WithWarningLevel(2); 1390option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1393option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1438option = commonoption.WithWarningLevel(3); 1444option = commonoption.WithWarningLevel(2); 1447option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1450option = commonoption.WithWarningLevel(2).WithSpecificDiagnosticOptions(warnings); 1517option = commonoption.WithWarningLevel(2); 1567option = commonoption.WithWarningLevel(2); 1620option = commonoption.WithWarningLevel(2); 1673option = commonoption.WithWarningLevel(2); 1717option = commonoption.WithWarningLevel(2); 1748option = commonoption.WithWarningLevel(2); 1794option = commonoption.WithWarningLevel(2); 1849option = commonoption.WithWarningLevel(2); 2282option = commonoption.WithWarningLevel(2);
Microsoft.VisualStudio.LanguageServices.CSharp (1)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
151.WithWarningLevel(warningLevel);