Code inspection: Static member initializer refers to static member below or in other part
This inspection reports a static field, property, or event initializer that reads another static member declared later in the type, or in a different type part. That member might not be initialized yet when the initializer runs.
Example
class C
{
public static int A = B + 1;
public static int B = 42;
}
class C
{
public static int B = 42;
public static int A = B + 1;
}
How to fix it
There is no dedicated quick-fix for this inspection. Move the referenced member above the initializer, or move the initialization logic into a static constructor.
01 April 2026