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

[BUG] Warning about nullable despite Nunit.Analyzers #1637

Open
eraserix opened this issue Nov 27, 2024 · 0 comments
Open

[BUG] Warning about nullable despite Nunit.Analyzers #1637

eraserix opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@eraserix
Copy link

Describe the Issue

In a unit test class that sets up members during "[SetUp]", VS Code displays the warning CS8618 (must contain non-null value). The code works as expected (dotnet format, dotnet test). Rider does not show this warning for the same test class.

Steps To Reproduce

  1. Add a field with an object inside a test class
  2. Add reference to Nunit analyzers through Directory.Packages.props, Directory.Test.props
  3. Initialize the field inside the [SetUp] Method.

Expected Behavior

The Nunit.Analyzers contain a suppressor rule that should suppress that warning about null if field is initialized in [SetUp].

Environment Information

  • OS: Linux, Ubuntu 22.04
  • dotnet 8.0.404 (unpacked tar.gz, available on $PATH through direnv)
  • VS Code 1.95.3
  • C# Dev Kit 1.13.9
@eraserix eraserix added the bug Something isn't working label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant