Repository navigation
Add C# 10 language feature audit tests - #4132
Merged
Merged
Conversation
From bjornhellander/NewStyleCopAnalyzers#161. Adapted while cherry-picking: upstream SA1009 already reports a missing space after a tuple return type, so the SA1009 change in the original commit is not needed and was left out; the tests use ConfigureAwait(false) and WorkItem(3986). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit c4d41b551bf0bcb9702f32f3ba0805634733e772)
From bjornhellander/NewStyleCopAnalyzers#163. Adapted while cherry-picking: the tests were merged into the existing upstream test classes and use ConfigureAwait(false) and WorkItem(3988). The SA1122 test was left out because it depends on a separate SA1122 change that reports empty interpolated strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 212fff80bf6685c71bbc733bd0ac2fd82d852ac9)
From bjornhellander/NewStyleCopAnalyzers#155. Adapted while cherry-picking: the tests were merged into the existing upstream test classes and use ConfigureAwait(false) and WorkItem(3980). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 043704336166fb1336e044ffd8787604074ce0bc)
From bjornhellander/NewStyleCopAnalyzers#158. Adapted while cherry-picking: the tests were merged into the existing upstream test classes and use ConfigureAwait(false) and WorkItem(3983). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit c033cbf235b805b4fd4735475c04ff81fdf9a128)
…d SA1516 From bjornhellander/NewStyleCopAnalyzers#154. Adapted while cherry-picking: the tests were merged into the existing upstream test classes and use ConfigureAwait(false) and WorkItem(3979). The TODO review notes were left out, as were the changes that only added TODO comments (SA1300UnitTests, SA1300CSharp9UnitTests, SA1401FieldsMustBePrivate). The SA1516 record test now uses a property followed by a method, because upstream SA1516 allows consecutive single-line properties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 79e011ac93d3b1f5a3554117903518dc632f87bd)
Covers SA1206 (both modifier orders, plus the access modifier code fix), SA1100 (base.ToString() with and without a sealed base ToString, and with a synthesized ToString), and SA1648 (inheritdoc on a sealed ToString). No product change was needed. Part of #3989
Covers SA1405 (an interpolated message that binds to the Debug.Assert interpolated string handler
overload) and SA1122 (the empty string in [InterpolatedStringHandlerArgument("")]). No product
change was needed.
Part of #3981
No product change was needed. SA1611 still reports an undocumented [CallerArgumentExpression] parameter, the same as [CallerMemberName] parameters. Part of #3991
From bjornhellander/NewStyleCopAnalyzers#159 ("Update SA1024 to check colons in extended property patterns, and add SA1019 tests for them"). Adapted while cherry-picking: only the SA1019 test is kept, with ConfigureAwait(false) and WorkItem(3984). The SA1024 product change and its tests were left out because master already has them (300a473, TestExtendedPropertyPatternSpacingAsync and TestPropertyPatternColonSpacingAsync). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 40709c68258a58ad99079478b5aafd53ac7c1853)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4132 +/- ##
==========================================
+ Coverage 97.41% 97.42% +0.01%
==========================================
Files 1118 1129 +11
Lines 124962 125493 +531
Branches 4203 4203
==========================================
+ Hits 121734 122266 +532
+ Misses 2116 2115 -1
Partials 1112 1112 🚀 New features to boost your workflow:
|
AArnott
marked this pull request as ready for review
October 8, 2026 03:37
AArnott
enabled auto-merge
October 8, 2026 14:06
# Conflicts: # StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp10/ReadabilityRules/SA1101CSharp10UnitTests.cs
This was referenced Oct 8, 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.
Part of #4042
This PR adds tests for C# 10 features that need no product change. It covers these sub-issues: #3979, #3980, #3981, #3983, #3984, #3986, #3988, #3989 and #3991.
Six commits are Björn Hellander's tests from his fork, cherry-picked with
-x. He is kept as the author. Each commit message notes how it was adapted: tests merged into the existing upstream test classes,ConfigureAwait(false), andWorkItemattributes. The other three commits add new tests.c4d41b551. His SA1009 product change was left out because master already reports SA1009 for(int, int) ()and his tests pass without it.212fff80b. His SA1122 test was left out because it depends on a separate SA1122 behavior change (see below).withon structs and anonymous types), SA1129, SA164204370433640709c682. His SA1024 product change and tests were left out because master already has them (300a473).c033cbf2379e011ac9. Changes that only added TODO comments were left out. The SA1516 test uses a property followed by a method, because upstream SA1516 allows consecutive single-line properties.ToStringin recordssealed overrideorders, plus the access-modifier fix), SA1100 (base.ToString()with a sealed base, with a synthesizedToString, and inside the sealed override), SA1648Debug.Asserthandler overload), SA1122 ([InterpolatedStringHandlerArgument("")])CallerArgumentExpressionNo product code changes.
Open questions, deliberately left out of this PR:
$"": SA1122 doesn't currently report the empty interpolated string$"". Björn's fork (5ec345e25) changes SA1122 to report$""and empty raw string literals. That's a behavior change, so it would need its own PR.[CallerArgumentExpression]parameter, just as it already does for[CallerMemberName],[CallerFilePath]and[CallerLineNumber]parameters. This PR keeps that behavior.The C# 10 product fixes are in separate PRs: #4131 (attributes on lambdas) and #4133 (SA1130 and natural types, #3985).