Skip to content

Commit

Permalink
Merge pull request dotnet#59248 from CyrusNajmabadi/langUpgradePreview
Browse files Browse the repository at this point in the history
Always allow the 'upgrade project' fixer to upgrade to 'preview' versions of C#
  • Loading branch information
CyrusNajmabadi authored Feb 3, 2022
2 parents 8c868c4 + b8ef114 commit 49fe412
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ public bool CanApplyChange(ParseOptions oldOptions, ParseOptions newOptions, str
{
return true;
}
else if (newCSharpOptions.LanguageVersion == LanguageVersion.Preview)
{
// It's always fine to upgrade a project to 'preview'. This allows users to try out new features to see
// how well they work, while also explicitly putting them into a *known* unsupported state (that's what
// preview is after all). Importantly, this doesn't put them into an unrealized unsupported state (for
// example, picking some combo of a real lang version that isn't supported with their chosen framework
// version).
return true;
}
else
{
Contract.ThrowIfFalse(LanguageVersionFacts.TryParse(maxLangVersion, out var parsedMaxLanguageVersion));
Expand Down

0 comments on commit 49fe412

Please sign in to comment.