Skip to content

chore: Remove EnablePreviewFeatures preview flag - #2180

Merged
DaveSkender merged 16 commits into
mainfrom
remove-preview-features-flag
Aug 21, 2026
Merged

DaveSkender merged 16 commits into
mainfrom
remove-preview-features-flag

Conversation

@DaveSkender

@DaveSkender DaveSkender commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Re-attempt of the removal deferred in #2026, per the trigger defined in #2162: the field keyword shipped as GA in C# 14 / .NET 10, so EnablePreviewFeatures=true (and GenerateRequiresPreviewFeaturesAttribute=false) is no longer load-bearing for the compiler.

Changes

  • Remove EnablePreviewFeatures / GenerateRequiresPreviewFeaturesAttribute from src/Indicators.csproj — the shipped package now builds with GA language features only
  • Scope LangVersion=preview to the two Roslynator analyze steps in ci.yml (see finding below)
  • Same override for the Roslynator analyze/fix tasks in .vscode/tasks.json

Findings

The original blocker from #2026 is resolved: the quick check build step compiles field cleanly on the GA SDK that setup-dotnet resolves for 10.x + ga (verified in this PR's first CI run, and locally on SDK 10.0.110: clean build on net10.0/net9.0/net8.0, 2,506 tests passing).

The residual blocker is Roslynator CLI 0.13.0 (latest on NuGet), whose bundled Roslyn still gates field behind preview (CS8652/CS0103). The LangVersion=preview overrides here are scoped to analysis only — functionally identical to what EnablePreviewFeatures already forced for Roslynator, while the shipped build is flag-free.

Status: on hold

Rather than carry the analysis-side workaround, this waits for the upstream Roslynator Roslyn 5.0 bump and a CLI release containing it (details in comment below). When that ships: bump dotnet-tools.json, drop the three LangVersion=preview overrides from this branch, and let quick check decide.

Closes #2162

The field keyword shipped as GA in C# 14 / .NET 10, so the preview
flag (and its RequiresPreviewFeatures attribute suppression) is no
longer needed. Local build is green across net10.0/net9.0/net8.0
with SDK 10.0.110; CI quick check is the deciding gate per #2162.
@DaveSkender
DaveSkender requested a review from a team August 10, 2026 00:31
@facioquoqa

facioquoqa Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

:neckbeard: FaciōQuōqa Mage Reviewer is standing by.

  • Trigger review

@codacy-production

codacy-production Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · +0.17% coverage variation

Metric Results
Coverage variation ✅ +0.17% coverage variation (-1.00%)
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (32cf0bd) 19497 18778 96.31%
Head commit (c9a7d0d) 19579 (+82) 18891 (+113) 96.49% (+0.17%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2180) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

The CI SDK's compiler now builds the field keyword as GA (the build
step passed without EnablePreviewFeatures), but Roslynator CLI 0.13.0
(latest available) bundles an older Roslyn that still gates field
behind preview. Pass LangVersion=preview to just the two Roslynator
analyze steps so the shipped package builds flag-free.
@DaveSkender

Copy link
Copy Markdown
Member Author

First run isolated the real blocker: the build step passed on the CI GA SDK (the original CS8652-from-setup-dotnet concern is resolved), but the Roslynator analyze step failed — Roslynator CLI 0.13.0 (latest on NuGet) bundles an older Roslyn that still gates field behind preview. Pushed a follow-up that scopes LangVersion=preview to just the two Roslynator invocations in ci.yml; analysis behavior is identical to today (the csproj flag already forced preview langversion for Roslynator), while the shipped package now builds flag-free. Verified locally: roslynator analyze exits 0 with only the pre-existing CS8795 source-generator artifact.

Same workaround as the CI analyze steps: Roslynator CLI 0.13.0
bundles a Roslyn that still gates the field keyword behind preview,
so the analyze/fix tasks need LangVersion=preview now that
EnablePreviewFeatures is removed from the csproj.
@DaveSkender

Copy link
Copy Markdown
Member Author

On hold — upstream dependency.

All checks are green here with the analysis-scoped workaround, but rather than merge LangVersion=preview overrides we'd immediately want to remove, this is parked until dotnet/roslynator#1787 (Bump Roslyn to 5.0) lands. That PR bumps RoslynatorCliRoslynVersion to 5.0.0 — the compiler generation where field is GA — which resolves the CS8652/CS0103 errors the Roslynator analyze step hits against this branch without the overrides.

Note the wait is for a released CLI version containing that bump, not just the merge: Roslynator.DotNet.Cli 0.13.0 is currently the latest on NuGet (the already-merged dotnet/roslynator#1783 SDK-10 loader fix is also awaiting a release).

Resume steps when it ships: bump roslynator.dotnet.cli in dotnet-tools.json, drop the three LangVersion=preview overrides (2× ci.yml, 1× .vscode/tasks.json), and let quick check decide.

@DaveSkender DaveSkender self-assigned this Aug 10, 2026
Comment thread .github/workflows/ci.yml Outdated

@DaveSkender DaveSkender left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold for next imminent release of Roslynator

Comment thread src/Common/AGENTS.md Outdated
Comment thread dotnet-tools.json Outdated
The tools manifest pinned roslynator.dotnet.cli 0.14.0, a presumptive
number for the release carrying the new Roslyn engine. That release
shipped as 1.0.0 — 0.14.0 never existed on NuGet, so `dotnet tool
restore` failed and every downstream CI job was skipped.

Pin the version that actually shipped, and bump Roslynator.Analyzers to
the matching 5.0.0 wave so the in-build analyzers run the same engine as
the CLI. Verified: CLI 1.0.0 analyzes Indicators.csproj with the plain
`--properties TargetFramework=net10.0` invocation — no LangVersion
override — reporting 0 diagnostics, which confirms the new engine
compiles the C# 14 field keyword as GA and the preview workaround this
branch removes is no longer needed anywhere. Full build is clean at 0
warnings with analyzers 5.0.0 under warnings-as-errors.
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Add missing newline at the end of Directory.Packages.props

Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
@DaveSkender
DaveSkender enabled auto-merge (squash) August 21, 2026 22:13
@DaveSkender
DaveSkender merged commit 5411859 into main Aug 21, 2026
8 checks passed
@DaveSkender
DaveSkender deleted the remove-preview-features-flag branch August 21, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold On hold / waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove EnablePreviewFeatures=true once CI SDK ships the field keyword as GA

1 participant