c# - 在 JetBrains Rider 中查找未使用的公共方法
问题描述
我有一个没有在任何地方使用的单一方法的接口:
public interface IInterface
{
int Foo();
}
public class MyClass : IInterface
{
public int Foo()
{
return 0;
}
}
但是,即使打开解决方案范围的分析,JetBrains Rider 也不会向我显示任何提示、警告或任何内容。我尝试在Editor > Inspection Settings > Inspection Severity > C# > Redundancies in Symbol Declarations > Type or member is never used中更改设置,并将私有和非私有都设置为Warning。但我仍然没有收到任何警告。找出该方法未在任何地方使用的唯一方法是右键单击它并选择Find usages。
是否有可能找到所有未使用的作为接口实现的公共方法?
解决方案
将 Rider 更新到版本 2019.2.2 后,Rider 还会检测接口中未使用的公共方法。但是,该功能非常不稳定,在重构了几个接口后,它再次停止工作。
推荐阅读
- javascript - 将 AJAX POST 请求从本地 .html 文件发送到 localhost:8080 时出错。CORS:“它没有 HTTP ok 状态。”
- swift - 在 Xcode 中,如何向我的 Mac 应用程序添加教程窗口,该窗口仅在首次启动时打开
- javascript - 如何在 JS 文件中使用 import?
- redux - Redux 测试:操作必须是普通对象。使用自定义中间件进行异步操作
- google-apps-script - 如何在 Google 脚本编辑器中引用单元格内的日期?
- r - 使用 ecdf 图中的值创建一个表
- visual-studio - 为什么 CRT 和 VS 内存分析的结果如此不同?
- mongodb - 使用 MongoDB 部分索引功能是否有效?
- bash - 列出 Cygwin/bash 脚本中包含空格的某些文件夹
- c++ - 内存分配心智图说明