是否可以使用 Roslyn 检测无法访问的代码或其他内置编译警告?
private void DoSomething()
{
string a = "TEST";
throw new Exception("Why would I throw an exception here?");
a = "This will never be reached"; //this is a compile time warning for unreachable code...Can I detect it?
}
我尝试检查语义和语法方法中的节点属性,但没有看到任何问题或警告集合。