Repository navigation
build: C# 15, LangVersion 15 (#829, step 3) - #870
Merged
Merged
Conversation
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.
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Step 3 of #829:
LangVersionmoves from14.0to15.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:
new(StringComparer.Ordinal)(or a capacity, orReferenceEqualityComparer.Instance) to[with(...)], and the MA0002 sites from[]to[with(StringComparer.Ordinal)]. One fixer output is tidied by hand:global::System.StringComparerreadsStringComparer.tools/,tests/or the HQ playground: nothing undersrc/changes, and the generator's emitted output is unchanged (generate --verifypasses).StringComparer.Ordinalis what the default string comparer does.docs/engineering/quality-gates.mdpinsLangVersion=15.0and its net472 sentence names C# 15; the twoDirectory.Build.propscomments follow.ADR-0034 impact
None on the packages: no public-surface or behaviour change, so no CHANGELOG line. Package validation against
1.1.0is 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 against1.1.0, and 11,331 of 11,331 tests (the service-election and Native AOT categories run in CI).Refs #829