For testing of scenarios, a suppression for IDE0044 was applied to this member in order to test that CA1805 was being successfully triggered, however in doing so, CA1805 was also being suppressed:
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Used for testing CA1805")]
class CA1805
{
//CA1805:Do not initialize unnecessarily
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Used for testing CA1805")]
int _value1 = 0;
//CA1805:Do not initialize unnecessarily
static readonly int _value2 = 0;
}
For testing of scenarios, a suppression for IDE0044 was applied to this member in order to test that CA1805 was being successfully triggered, however in doing so, CA1805 was also being suppressed:
The comment within your source indicates that attributes are excluded in case they impact nullability analysis, however even scalar attributes are now impacted by this approach https://github.com/dotnet/roslyn-analyzers/blob/43709af7570da7140fb3e9a5237f55ffb24677e7/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/QualityGuidelines/DoNotInitializeUnnecessarily.cs#L50
Is it possible restrict only attributes which do impact nullability analysis?