148 references to WithFeature
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (31)
CodeGen\CodeGenAsyncTests.cs (4)
8620parseOptions = parseOptions.WithFeature(Feature.RuntimeAsync, "off"); 8670parseOptions = parseOptions.WithFeature(Feature.RuntimeAsync, "off"); 8710parseOptions = parseOptions.WithFeature(Feature.RuntimeAsync, "off"); 8772parseOptions = parseOptions.WithFeature(Feature.RuntimeAsync, "off");
CodeGen\ForeachTest.cs (1)
1683var comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never"));
Emit\EmitErrorTests.cs (3)
356parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "1000000")) 360parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals), 365parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"),
Emit\EmitMetadataTests.cs (23)
2950var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0")); 2956comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0")); 2962comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0")); 2971comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "1")); 2980comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "3")); 3023parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, null), 3034parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, feature), 3042parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "1000"), 3049parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "3"), 3056parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "2"), 3076parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "1"), 3096parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3131parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3232parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0")); 3244parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3282parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0")) 3297parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3398parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, feature), 3423parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3465parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3511parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3548parseOptions: TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"), 3623parseOptions: parseOptions.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"))
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (3)
Emit\EditAndContinue\EditAndContinueTests.cs (3)
17525var parseOptions = TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"); 21051var parseOptions = TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0"); 21150var parseOptions = TestOptions.Regular.WithFeature(Feature.ExperimentalDataSectionStringLiterals, "0");
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (9)
Attributes\AttributeTests_Nullable.cs (4)
3473AssertNullableAttributes(CreateCompilation(source, options: options, parseOptions: parseOptions.WithFeature(Feature.NullablePublicOnly)), expectedPublicOnly); 3475AssertNullableAttributes(CreateCompilation(new[] { source, sourceIVTs }, options: options, parseOptions: parseOptions.WithFeature(Feature.NullablePublicOnly)), expectedPublicAndInternal); 3590comp = CreateCompilation(new[] { sourceAttribute, source }, options: options, parseOptions: parseOptions.WithFeature(Feature.NullablePublicOnly)); 3649comp = CreateCompilation(new[] { sourceAttribute, source }, options: options, parseOptions: parseOptions.WithFeature(Feature.NullablePublicOnly));
Semantics\PrimaryConstructorTests.cs (3)
3266var comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 6968var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.WithFeature(Feature.RunNullableAnalysis, "never"), targetFramework: TargetFramework.NetCoreApp); 6994var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.WithFeature(Feature.RunNullableAnalysis, "never"), targetFramework: TargetFramework.NetCoreApp);
Semantics\RecordTests.cs (2)
30563var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never"), targetFramework: TargetFramework.NetCoreApp); 30587var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never"), targetFramework: TargetFramework.NetCoreApp);
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
EndToEndTests.cs (1)
682var verifier = CompileAndVerify(files.ToArrayAndFree(), parseOptions: TestOptions.Regular.WithFeature(Feature.InterceptorsNamespaces, "global"), expectedOutput: makeExpectedOutput());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (80)
Semantics\InterceptorsTests.cs (33)
36private static readonly CSharpParseOptions RegularWithInterceptors = TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "global"); 37private static readonly CSharpParseOptions RegularPreviewWithInterceptors = TestOptions.RegularPreview.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "global"); 121comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature("InterceptorsPreview-experimental")); 124comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature("InterceptorsPreview", "false")); 127comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature("interceptorspreview")); 130comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature("InterceptorsPreview", "Global")); 133comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature("InterceptorsPreview", "global.a")); 166var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS")); 172comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS1.NS2")); 178var verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS1"), expectedOutput: "1"); 181verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS1;NS2"), expectedOutput: "1"); 188test(TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS"), expectedOutput: null, 193test(TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS1.NS2"), expectedOutput: null, 198test(TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS1"), expectedOutput: "1"); 200test(TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "NS1;NS2"), expectedOutput: "1"); 295var comp = CreateCompilation([source, interceptor, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, featureValue)); 304var verifier = CompileAndVerify([source, interceptor, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, featureValue), expectedOutput: "1"); 332var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "")); 364var verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "global"), expectedOutput: "1"); 367verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "global"), expectedOutput: "1"); 398var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "global.A")); 6826var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 6873var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 6926var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 6975var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 7031var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 7079var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 7126var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: featureExists ? TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "") : TestOptions.Regular); 7170var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors;Interceptors")); 7198var comp = CreateCompilation(new[] { source, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 7217var comp = CreateCompilation([], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors")); 7257var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, @namespace)); 7300var comp = CreateCompilation([source, interceptorSource, s_attributesSource], parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.InterceptorsNamespaces, "Interceptors.Nested"));
Semantics\LocalFunctionTests.cs (3)
2361var comp = CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.Regular12.WithFeature(Feature.RunNullableAnalysis, "never")); 2435CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.Regular13.WithFeature(Feature.RunNullableAnalysis, "never")).VerifyDiagnostics(expectedDiagnostics); 2436CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.RegularPreview.WithFeature(Feature.RunNullableAnalysis, "never")).VerifyDiagnostics(expectedDiagnostics);
Semantics\NullableContextTests.cs (23)
185verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, null), expectedAnalyzedKeysDefault); 186verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "always"), expectedAnalyzedKeysAll); 187verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never")); 188verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "ALWAYS"), expectedAnalyzedKeysDefault); // unrecognized value (incorrect case) ignored 189verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "NEVER"), expectedAnalyzedKeysDefault); // unrecognized value (incorrect case) ignored 190verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "true"), expectedAnalyzedKeysDefault); // unrecognized value ignored 191verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "false"), expectedAnalyzedKeysDefault); // unrecognized value ignored 192verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "unknown"), expectedAnalyzedKeysDefault); // unrecognized value ignored 239verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, null), expectedAnalyzedKeysDefault); 240verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "always"), expectedAnalyzedKeysAll); 241verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never")); 298verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, null), expectedAnalyzedKeysDefault); 299verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "always"), expectedAnalyzedKeysAll); 300verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never")); 340verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, null), expectedFlowState: true, expectedAnalyzedKeysAll); 341verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "always"), expectedFlowState: true, expectedAnalyzedKeysAll); 342verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never"), expectedFlowState: false); 379verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, null), expectedFlowState: true, expectedAnalyzedKeysAll); 380verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "always"), expectedFlowState: true, expectedAnalyzedKeysAll); 381verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never"), expectedFlowState: false); 414verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, null), expectedFlowState: true, expectedAnalyzedKeysAll); 415verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "always"), expectedFlowState: true, expectedAnalyzedKeysAll); 416verify(parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never"), expectedFlowState: false);
Semantics\NullableReferenceTypesTests.cs (11)
5246var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: TestOptions.DebugDll); 5292var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: TestOptions.DebugDll.WithNullableContextOptions(NullableContextOptions.Disable)); 5338var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: TestOptions.DebugDll.WithNullableContextOptions(NullableContextOptions.Enable)); 10615var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: WithNullableEnable()); 10774var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: WithNullableEnable()); 10937var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: WithNullableEnable()); 11127var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: WithNullableEnable()); 71881var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(CodeAnalysis.Feature.RunNullableAnalysis, "always"), options: WithNullableEnable()); 81254parseOptions: TestOptions.Regular8.WithFeature("staticNullChecking")); 81265parseOptions: TestOptions.Regular8.WithFeature("staticNullChecking", "0")); 81276parseOptions: TestOptions.Regular8.WithFeature("staticNullChecking", "1"));
Semantics\RefFieldTests.cs (8)
8390var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.WithFeature(Feature.PEVerifyCompat), targetFramework: TargetFramework.Net70); 13499comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 13563comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 13639comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 13710comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 15192comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 28007comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never")); 28067comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature(Feature.RunNullableAnalysis, "never"));
Semantics\UsingStatementTests.cs (1)
1848var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.WithFeature(Feature.RunNullableAnalysis, "never"));
SourceGeneration\GeneratorDriverTests.cs (1)
4281var parseOptions = TestOptions.RegularPreview.WithFeature(Feature.InterceptorsNamespaces, "global");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Symbols\Source\NullablePublicAPITests.cs (4)
1737var featureFlagOff = TestOptions.Regular8.WithFeature(Feature.RunNullableAnalysis, "never"); 2623var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8.WithFeature(Feature.RunNullableAnalysis, flagState)); 5181var comp = CreateCompilation(source, parseOptions: runNullableAnalysisAlways ? TestOptions.RegularPreview.WithFeature(Feature.RunNullableAnalysis, "always") : TestOptions.RegularPreview); 5219var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.WithFeature(Feature.RunNullableAnalysis, "never"));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (15)
Parsing\IgnoredDirectiveParsingTests.cs (15)
73UsingTree(source, options.WithFeature(FeatureName)); 110parseOptions: TestOptions.Regular.WithFeature(FeatureName), 120var root = SyntaxFactory.ParseCompilationUnit(source, options: TestOptions.Regular.WithFeature(FeatureName)); 142var root = SyntaxFactory.ParseCompilationUnit(source, options: TestOptions.Regular.WithFeature(FeatureName)); 162var root = SyntaxFactory.ParseCompilationUnit("#!abc", options: TestOptions.Regular.WithFeature(FeatureName)); 179options = options.WithFeature(FeatureName); 235UsingTree(source, TestOptions.Regular.WithFeature(FeatureName), 302UsingTree(source, TestOptions.Regular.WithFeature(FeatureName).WithPreprocessorSymbols("X"), 370UsingTree(source, TestOptions.Regular.WithFeature(FeatureName), 446UsingTree(source, TestOptions.Regular.WithFeature(FeatureName)); 486UsingTree(source, TestOptions.Regular.WithFeature(FeatureName)); 535UsingTree(source, TestOptions.Regular.WithFeature(FeatureName)); 562UsingTree(source, TestOptions.Regular.WithFeature(FeatureName), 604UsingTree(source, TestOptions.Regular.WithFeature(FeatureName)); 629UsingTree(source, TestOptions.Regular.WithFeature(FeatureName),
Microsoft.CodeAnalysis.CSharp.Test.Utilities (5)
CSharpTestBase.cs (1)
3207internal static CSharpParseOptions WithRuntimeAsync(CSharpParseOptions options) => options.WithFeature(Feature.RuntimeAsync, "on");
TestOptions.cs (4)
49public static readonly CSharpParseOptions RegularWithLegacyStrongName = Regular.WithFeature(Feature.UseLegacyStrongNameProvider); 129return options.WithFeature(Feature.NullablePublicOnly); 134return options.WithFeature(Feature.NoRefSafetyRulesAttribute); 139return options.WithFeature(Feature.DisableLengthBasedSwitch);