chore: Remove EnablePreviewFeatures preview flag - #2180
Conversation
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.
|
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
🟢 Coverage ∅ diff coverage · +0.17% coverage variation
Metric Results Coverage variation ✅ +0.17% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage 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.
|
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 |
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.
|
On hold — upstream dependency. All checks are green here with the analysis-scoped workaround, but rather than merge Note the wait is for a released CLI version containing that bump, not just the merge: Resume steps when it ships: bump |
…" field keyword)" This reverts commit f2b886b.
…ioquo/stock-indicators-dotnet into remove-preview-features-flag
DaveSkender
left a comment
There was a problem hiding this comment.
Hold for next imminent release of Roslynator
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>
Re-attempt of the removal deferred in #2026, per the trigger defined in #2162: the
fieldkeyword shipped as GA in C# 14 / .NET 10, soEnablePreviewFeatures=true(andGenerateRequiresPreviewFeaturesAttribute=false) is no longer load-bearing for the compiler.Changes
EnablePreviewFeatures/GenerateRequiresPreviewFeaturesAttributefromsrc/Indicators.csproj— the shipped package now builds with GA language features onlyLangVersion=previewto the two Roslynator analyze steps inci.yml(see finding below).vscode/tasks.jsonFindings
The original blocker from #2026 is resolved: the
quick checkbuild step compilesfieldcleanly on the GA SDK thatsetup-dotnetresolves for10.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
fieldbehind preview (CS8652/CS0103). TheLangVersion=previewoverrides here are scoped to analysis only — functionally identical to whatEnablePreviewFeaturesalready 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 threeLangVersion=previewoverrides from this branch, and letquick checkdecide.Closes #2162