Repository navigation
SA1205: treat the C# 11 file modifier as an access modifier - #4198
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4198 +/- ##
=======================================
Coverage 97.54% 97.54%
=======================================
Files 1277 1277
Lines 134157 134168 +11
Branches 4291 4292 +1
=======================================
+ Hits 130863 130875 +12
+ Misses 2152 2151 -1
Partials 1142 1142 🚀 New features to boost your workflow:
|
AArnott
marked this pull request as ready for review
October 9, 2026 15:20
bjornhellander
approved these changes
Oct 9, 2026
bjornhellander
suggested changes
Oct 9, 2026
| yield return new object[] { "record struct" }; | ||
| } | ||
|
|
||
| if (LightupHelpers.SupportsCSharp11) |
Contributor
There was a problem hiding this comment.
Codecov says this if statement is only partially covered. I don't see how that is possible, so might be worth a check.
Contributor
Author
There was a problem hiding this comment.
I suspect that's because the condition always evaluates to true. So the missing coverage is of the jmp that skips past the 'true' block.
This was referenced Nov 11, 2026
Bump StyleCop.Analyzers from 1.2.0-beta.556 to 1.3.180
microsoftgraph/aspnetcore-webhooks-sample#436
Open
Closed
This was referenced Nov 23, 2026
Open
[DPDBT] Bump Microsoft.CodeAnalysis.Analyzers and 6 others
sergey-rybalkin/CommandLine.Generators#63
Open
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.
Fixes #3906
SA1205 asked for an access modifier on
file partial class, butfilealready is the type's accessibility, and addingpublic/internalwould be a compile error (CS0106).This builds on @bjornhellander's original draft commit 2e31c40 ("Update SA1205 to recognize the file keyword"), which treats
SyntaxKindEx.FileKeywordas an access modifier. That commit was never opened as a PR. I merged current master into it and added:ValidDeclarationscases underSupportsCSharp11:file static/sealed partial class,file partial interface,file partial record,file partial record struct. These live in the C# 6 base class, so they run from the C# 11 test project onward. All 7filecases fail on master.documentation/SA1205.md.It's one more modifier check, so there's no perf cost.