代码检查:无法访问实参中的符号
某些框架使用字符串文字来引用代码符号。 即使名称正确,引用的成员在当前上下文中仍可能无法访问。 当被引用的符号存在但由于其可见性无法访问时,例如因为它是 private 或当前位置无法使用时,此检查会报告基于字符串的符号引用。
示例
class Person
{
private string FullName => "John Smith";
}
[SomeFrameworkAttribute("FullName")]
class Example
{
}
class Person
{
public string FullName => "John Smith";
}
[SomeFrameworkAttribute("FullName")]
class Example
{
}
2026年 5月 8日