Skip to content

Design a more general test hook solution for runtime feature flags #63223

@jcouv

Description

@jcouv

We took some steps towards centralizing such logic into the following signature as part of ref fields PR #62941

public static CSharpCompilation CreateCompilation(
            CSharpTestSource source,
            IEnumerable<MetadataReference> references = null,
            CSharpCompilationOptions options = null,
            CSharpParseOptions parseOptions = null,
            TargetFramework targetFramework = TargetFramework.Standard,
            string assemblyName = "",
            string sourceFileName = "",
            bool skipUsesIsNullable = false,
            RuntimeFlag runtimeFeature = RuntimeFlag.None)

We need to confirm whether we want to keep a separate RuntimeFlag (which should not be used in conjunction with TargetFramework) or whether we want to use the TargetFramework to signal that information (create a dummy entry for new framework and fake it using an older framework plus the test hook for runtime feature flag).

Features that use a runtime feature flag as part of metadata decoding need to use skipUsesIsNullable: true, skipExtraValidation: true when using the test hook, but we should consider whether to just always do that.

Finally, there are some questions around the use of CopyWithoutSharingCachedSymbols(). There's a specific follow-up issue (#63222) on that, but we'll need to resolve that to establish a common pattern for new features.

FYI @cston, @333fred

Metadata

Metadata

Assignees

Labels

Area-CompilersConcept-Design DebtEngineering Debt, Design Debt, or poor product code qualityTestTest failures in roslyn-CI

Type

No type

Projects

Status

Active/Investigating

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions