This document describes the PX1062 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1062 | You cannot declare static views, actions, mutable fields, and properties in graphs or graph extensions | Error | Available |
In graphs and graph extensions, it is strictly forbidden to use the following static members: actions, views, mutable properties, and mutable fields. The diagnostic shows the error for these static members.
The diagnostic behavior and the code fix depend on the type of field or property as follows:
- For a static view or action, the diagnostic always reports an error. The only available code fix is to remove the static keyword. Even if the action or view is read-only, it is still forbidden.
- Other static fields and properties are reported only if they are mutable (not read-only). In that case, two code fixes are available:
- Make the field or property read-only. Note that the fix works differently for fields and properties. For a field, the fix adds the
readonly
modifier. For a property, the fix removes the property setter. - Remove the
static
modifier.
- Make the field or property read-only. Note that the fix works differently for fields and properties. For a field, the fix adds the
public class SomeGraph : PXGraph<SomeGraph>
{
public static int SalesSubMask;
public static PXAction<PX.Objects.AR.ARInvoice> Release;
public static IFinPeriodRepository FinPeriodRepository { get; set; }
}
public class SomeGraph : PXGraph<SomeGraph>
{
// the fix added the readonly modifier
public static readonly int SalesSubMask;
// the fix removed the static modifier
public PXAction<PX.Objects.AR.ARInvoice> Release;
// the fix removed the static modifier
public IFinPeriodRepository FinPeriodRepository { get; set; }
}