コードインスペクション:テキスト引数で静的シンボルにアクセスできません
一部のフレームワークでは、フィールド、プロパティ、メソッドなどのコードシンボルを参照するために文字列リテラルを使用します。 静的メンバーは、インスタンスメンバーを必要とする場所では必ずしも使用できるとは限りません。 このインスペクションエラーは、参照されるシンボルが静的であるにもかかわらず、ターゲットコンテキストでインスタンスメンバーが必要な場合に、文字列ベースのシンボル参照を報告します。
サンプル
class Person
{
public static string FullName => "John Smith";
}
// The string is expected to point to an instance member.
[SomeFrameworkAttribute("FullName")]
class Example
{
}
class Person
{
public string FullName => "John Smith";
}
[SomeFrameworkAttribute("FullName")]
class Example
{
}
2026 年 6 月 12 日