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

CS8618 not suppressed #4075

Closed
AndrewNikolin opened this issue Nov 18, 2024 · 1 comment
Closed

CS8618 not suppressed #4075

AndrewNikolin opened this issue Nov 18, 2024 · 1 comment

Comments

@AndrewNikolin
Copy link

Describe the bug

I've just installed MSTest.Analyzers into multiple test projects, yet don't see the CS8618 been suppressed in those. The code of https://github.com/microsoft/testfx/blob/main/src/Analyzers/MSTest.Analyzers/NonNullableReferenceNotInitializedSuppressor.cs looks somewhat suspicious to me as I see some doc comments and properties reference the resources for a different suppressor, which might also be the cause this suppressor doesn't surface in Visual Studio/Rider analyzers.

Steps To Reproduce

I've created a repro solution with this issue https://github.com/AndrewNikolin/cs8618-repro
Also here is a warning in the build log
0>Test1.cs(6,23): Warning CS8618 : Non-nullable field '_testClass' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Warning in IDE
Image

Missing analyzer
Image

Expected behavior

CS8618 is suppressed

Actual behavior

CS8618 warning is surfaced

Additional context

I wanted to try fix issue myself, but my first attempt to run some tests in the project didn't succeed in a limited time, so I might give another try when I have some more free time. Logging this in the meanwhile, if anyone else is able to pick this up

@AndrewNikolin
Copy link
Author

Ugh, my bad. It is intended to suppress only TestContext, when I first read the doc somehow missed this 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant