Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet_analyzer_diagnostic.severity Does Not Work with TreatWarningsAsErrors #55541

Closed
RehanSaeed opened this issue Aug 11, 2021 · 1 comment · Fixed by #58460
Closed

dotnet_analyzer_diagnostic.severity Does Not Work with TreatWarningsAsErrors #55541

RehanSaeed opened this issue Aug 11, 2021 · 1 comment · Fixed by #58460

Comments

@RehanSaeed
Copy link

Version Used:

  • VS 2019, .NET 5, #error version = Compiler version: '3.11.0-4.21403.6 (ae1fff34)'. Language version: latest (9.0).
  • .NET CLI 5.0.400 #error version = Compiler version: '3.11.0-4.21373.6 (bb3bdbbe)'. Language version: 9.0..

Steps to Reproduce:

  1. dotnet new console
  2. Add this .editorconfig file to the root of the project, it contains:
[*.{cs,csx,cake,vb,vbx}]
# Default Severity for all .NET Code Style rules below
dotnet_analyzer_diagnostic.severity = warning
  1. Add <TreatWarningsAsErrors>true</TreatWarningsAsErrors> to the .csproj file.
  2. dotnet build
  3. You get warnings instead of errors.

Expected Behavior:

You should get errors.

Actual Behavior:

You get warnings.

See also @sharwell's comments in #43051 (comment)

@mavasani
Copy link
Contributor

Verified that this is indeed a bug that would need fixing. Thanks for reporting it.

@jinujoseph jinujoseph modified the milestones: 17.0, 17.1 Dec 10, 2021
mavasani added a commit to mavasani/roslyn that referenced this issue Dec 22, 2021
…rconfig

Fixes batch compiler issue in dotnet#55541. I'll create a separate PR for the fix on IDE side
mavasani added a commit to mavasani/roslyn that referenced this issue Dec 22, 2021
…ation in editorconfig

Underlying issue: dotnet#55541
Corresponding batch compiler fix: dotnet#58460
This change fixes the code that computes effective severity for Analyzers node. We also need to update the code that computes effective severity for EditorConfig UX, I will file a separate issue for the same.

NOTE: We have dotnet#52720 to track avoiding code duplication for computing effective severity between EditorConfig UX and other parts of the IDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants