dotnet / dotnet/roslyn

IDE1006: Naming rule violation: Prefix 's_' is not expected after upgrading to .NET 9 SDK

Open
#74,381 0 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Using SDK 9.0.100-preview.6.24328.19

Minimal repro:
https://github.com/Treit/UnexpectedPrefix

After upgrading to the .NET 9 SDK, a project that used to build without warnings now gives the following warning:

```
IDE1006: Naming rule violation: Prefix 's_' is not expected
```

The same project with the same .editorconfig builds without warnings using the .NET 8 SDK.

While we do not want to force the use of `s_` for static members, we want to allow it to be used if the developer wants to.

Note that in the minimal repro we even set this line in the .editorconfig to suggestion, but it is still treated as a warning:

```
dotnet_naming_rule.private_or_internal_static_field_should_be_pascal_case.severity = suggestion
```

Removing this line entirely makes the warning go away.

This seems like an undesired regression and it is not clear how to get back to the .NET 8 SDK behavior.

Contributor guide

Open the contributing guide

Research direction

Start with the linked Treit/UnexpectedPrefix minimal repro and its .editorconfig, then compare the IDE1006 result under the .NET 8 and .NET 9 SDKs. Trace the naming-rule severity handling for private or internal static fields; done means the same configuration permits the s_ prefix without producing an unexpected warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.