Skip to content

build: C# 15, LangVersion 15 (#829, step 3) - #870

Merged
Blind-Striker merged 1 commit into
masterfrom
build/829-langversion-15
Nov 14, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
build/829-langversion-15

Conversation

@Blind-Striker

Copy link
Copy Markdown
Collaborator

What

Step 3 of #829: LangVersion moves from 14.0 to 15.0. Preview features stay off.

Under C# 15 the analyzer wall asks for the new collection-expression arguments: IDE0028 (an error here) wherever a collection is built with a comparer or a capacity, and MA0002 for the comparer on empty string-set collection expressions. The maintainer chose to adopt that form at those sites in this change, so the switch lands with them:

  • The analyzers' own code fixes rewrite each site from new(StringComparer.Ordinal) (or a capacity, or ReferenceEqualityComparer.Instance) to [with(...)], and the MA0002 sites from [] to [with(StringComparer.Ordinal)]. One fixer output is tidied by hand: global::System.StringComparer reads StringComparer.
  • Every site is in tools/, tests/ or the HQ playground: nothing under src/ changes, and the generator's emitted output is unchanged (generate --verify passes).
  • Behaviour is unchanged: each collection keeps its concrete type, comparer, capacity and elements; StringComparer.Ordinal is what the default string comparer does.
  • docs/engineering/quality-gates.md pins LangVersion=15.0 and its net472 sentence names C# 15; the two Directory.Build.props comments follow.

ADR-0034 impact

None on the packages: no public-surface or behaviour change, so no CHANGELOG line. Package validation against 1.1.0 is unaffected.

Verification

Linux, at this head: the Release build with 0 warnings and 0 errors, both format passes, the slop scan, the clone gate, generate --verify, refresh-spec --verify, both packs against 1.1.0, and 11,331 of 11,331 tests (the service-election and Native AOT categories run in CI).

Refs #829

LangVersion moves from 14.0 to 15.0. Under C# 15, IDE0028 (an error
here) asks for collection-expression arguments where a collection is
built with a comparer or a capacity, and MA0002 asks for the comparer
on empty string-set collection expressions. The analyzers' own code
fixes rewrite those sites to [with(...)]; every site is in tools, tests
or the HQ playground, none in src. Behaviour is unchanged: the comparers
and capacities are the ones the constructors took, and the MA0002 sites
pass StringComparer.Ordinal, which is what the default string comparer
does. One fixer output is tidied by hand: global::System.StringComparer
becomes StringComparer.

The numeric pin in quality-gates.md and the C# version in its net472
sentence and in the Directory.Build.props comments follow.
@Blind-Striker
Blind-Striker added this pull request to the merge queue Nov 14, 2026
Merged via the queue into master with commit 7242aad Nov 14, 2026
17 checks passed
@Blind-Striker
Blind-Striker deleted the build/829-langversion-15 branch November 14, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant