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 format] EnforceCodeStyleInBuild behaves weird with NUnit Roslyn suppressors #44867

Open
BinaryTENSHi opened this issue Nov 14, 2024 · 2 comments
Labels
Area-Format untriaged Request triage from a team member

Comments

@BinaryTENSHi
Copy link

Describe the bug

The NUnit.Analyzers project provides a suppressor that suppresses the CS8616 error when a non-nullable field is being initialized via a SetUp or OneTimeSetUp method. See: https://docs.nunit.org/articles/nunit-analyzers/NUnit3002.html

Having EnforceCodeStyleInBuild set to true seems to not run or ignore this suppressor and dotnet format --verify-no-changes errors out with a CS8616 error.

To Reproduce

I have created a minimal reproducible example here: https://github.com/BinaryTENSHi/dotnet-format-nunit-suppress

  1. Clone the repository
  2. Run dotnet format --verify-no-changes

Further technical details

dotnet --info

.NET SDK:
 Version:           9.0.100
 Commit:            59db016f11
 Workload version:  9.0.100-manifests.3068a692
 MSBuild version:   17.12.7+5b8665660

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/user/.dotnet/sdk/9.0.100/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  6.0.428 [/home/user/.dotnet/sdk]
  8.0.403 [/home/user/.dotnet/sdk]
  9.0.100 [/home/user/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.36 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.5 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.10 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.36 [/home/user/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.5 [/home/user/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [/home/user/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.10 [/home/user/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [/home/user/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/home/user/.dotnet/]

global.json file:
  /home/user/work/dotnet-format-nunit-suppress/global.json
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Nov 14, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Format untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants