Explicit interface implementation are not "unused"

Rule “[Unused private types or members should be removed]”
incorrectly says “Remove the unused private property ‘IDataErrorInfo.this[]’.”

SonarQube 8.0 (through Codacy website)
(And I have not seen any fix in changelog for version 8.1)

Minimal Code:

namespace Issue
{
    public class Foo : System.ComponentModel.IDataErrorInfo
    {
        string IDataErrorInfo.this[string propertyName] { get { return null; /* Not relevant for sample */ } }
        string IDataErrorInfo.Error                     { get { return null; /* Not relevant for sample */ } }
    }
}

Hi @Mickael

Welcome to our community!

I’ve tried to reproduce the issue, with your sample and the latest version of the analyzer, and the false positive is not raised.

Can you please share more details?

  • the CSharp analyzer version
  • the .net version used by the project
  • if you have already a small project which reproduces the issue this will help us a lot

Thank you,
Costin