S1128 raised when namespace is referenced by type used in comment

Having the following class:

namespace TestNameSpace
{
  using System.Collections.Generic;

  /// <seealso cref="List{T}" />
  public class Test
  {
  }
}

The sonarqube server (version 9.4.0) reports the issue “S1128 Remove this unnecessary ‘using’” for the using statement even the namespace is used, but “only” in the comment.

I think this is a false-positive.

Hey there.

Thanks for the report. We are already tracking this false-positive here! Fix S1128 FP: documentation tags with dotnet build command · Issue #3633 · SonarSource/sonar-dotnet · GitHub

Yes, it looks simlar.
Unfortunately it is open since more than one year…

You could not reproduce it?
I also tried to make it reproducible in sonar-dotnet. But I failed (too).

Any idea?

Hi @lg2de, thanks for reporting this. I think @Pavel_Mikula managed to reproduce the issue. Unfortunately, we did not had time yet to tackle the problem.

Hi @lg2de

Thanks for reporting this, I added a link to this post on the issue.

Could you please tell us the version of dotnet / MSBuild you are using?

There are repro steps in the ticket, although more info about your build system will give us more details. TL;DR: the compiler seems to behave differently depending on its version.

Yes, we are slowly (and steadily) addressing our backlog while continuously bringing new value. Having information from the community forum can make us prioritize some issues over others, so thanks a lot for being active on this.

And, not to forget, we are hiring (Careers | Sonar) , so if you have friends, please let them know :smile:

Thanks!
Andrei

We do not use explicitly MSBuild, but Visual Studio 2022. Such issues happens e.g. in projects targeting .NETFramework 4.7.2.

I tried to make it reproducible within the sonar-dotnet project. But the unit tests I created never failed.