dotnet / dotnet/roslyn

IDE0021 showing up as warning despite being silent in editorconfig

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

Description

**Version Used**:
Visual Studio 17.13.0 Preview 1.0 and .Net 8.0.206

**Steps to Reproduce**:
Clone https://github.com/logankp/AnalyzerBug and open Class1.cs in Visual Studio or VS Code. Observe the constructor being underlined in yellow squiggles and showing up as a warning.

**Diagnostic Id**:

IDE0021: Use expression body for constructor

**Expected Behavior**:
IDE0021 should not show up as a warning.
**Actual Behavior**:
IDE0021 is showing up as a warning.

I have this configured in `.editorconfig` as such:
```
[*.cs]

csharp_style_expression_bodied_constructors = true:silent
```

Contributor guide

Open the contributing guide

Research direction

Reproduce with the linked AnalyzerBug repository by opening Class1.cs in Visual Studio or VS Code, then inspect its .editorconfig and the IDE0021 diagnostic. Compare the configured silent severity with the warning shown; done means IDE0021 no longer appears as a warning under this configuration.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.