规则 S1144 "Remove unused private method" c# - VS 2015

Rule S1144 "Remove unused private method" c# - VS 2015

方法 Visit(Leaf v)Visit(Composite v) 被 SonarLint 标记为未使用。 SonarQube 也将其标记为未使用。但它是动态调用的。 有人知道如何解决吗?可能有一些配置? 入口点是一个 Visit(Base root),然后使用动态调用它将遍历树。

UPD:更新示例

这是样本:

public void Visit(Base root)
{
   Visit((dynamic)root);
}

private void Visit(Composite v )
{
    v.Children.ForEach(el => Visit((dynamic)el));
}

private void Visit(Leaf v)
{
    // do smth
}

class Base
{
} 

class Composite : Base
{
    public IEnumerable<Base> Children { get;}
}

class Leaf : Base
{

}

这是 SonarLint 中的误报。目前没有解决这个问题。当我们解析方法引用时,我们可能应该使用 CandidateSymbols 。我在这里为它创建了一张票:https://jira.sonarsource.com/browse/SLVS-1080