Unused field not reported in Roslyn build
Version Used: b7e891b8a884be1519a709edc7121140c5a1fac2
Not sure if this is infra or analyzer issue, but I would expect this unused field to generate IDE0052 warning during CI builds:
https://github.com/dotnet/roslyn/blob/b7e891b8a884be1519a709edc7121140c5a1fac2/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs#L32
The IDE0052 warning is reported in IDE (both VS and VSCode) but not during builds.
Btw, this field reports the warning during builds if suppressions around it are removed:
https://github.com/dotnet/roslyn/blob/b7e891b8a884be1519a709edc7121140c5a1fac2/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs#L63
Saw this in Razor too with IDE0040, Remove accessibility modifiers.
We enabled the rule in our repo and fixed all violations in CI: https://github.com/dotnet/razor/pull/11466
But it seems our CI didn't pick up all the violations, as the SDK build failed due to violations in our code, after that change was inserted: https://github.com/dotnet/sdk/pull/46633#issuecomment-2648328458
The violations were shown in the IDE, but unless you know what files to look at, thats hardly very useful. It makes me very nervous to update anything in any of our .editorconfig files if we can't trust our own CI.
Some discussion and investigation, for context on Teams
I want to say there are funky rules for whether a field is considered unused, when a non-constant is written to it. This came up when deciding on the rules for field keyword, when it is read but never written, or vice-versa. I believe the reasoning is that we don't want to advise the user to delete a field declaration, when its initializer may have side effects.