- What language is this for? C#
- Which rule? S1128
- Why do you believe it’s a false-positive/false-negative? false-positive
- Are you using
- SonarQube Cloud? No
- SonarQube Server / Community Build - which version? v25.1.0.102122
- SonarQube for IDE - which IDE/version? VS 2022
- in connected mode with SonarQube Server / Community Build or SonarQube Cloud? SonarQube Community Build
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
Obsolete attribute requires ‘using System;’ but it is marked as unnecessary in the analysis
using System; // S1128 raised here
namespace TestNameSpace
{
public class TestClass
{
#if !NET48
[Obsolete("Obsolete message")] // requires using System;
#endif
public IEnumerable<T> GetList<T>()
{
// implementation
}
}
}