This document describes the PX1000 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1000 | The action delegate has incompatible return type and parameters. | Error | Available |
A valid signature of an action delegate method must satisfy the following requirements:
- The action delegate method must have the same name as its corresponding graph action (the
PXActionfield) but with a different casing for the first letter. Acumatica naming conventions recommend using the camel case for action delegate methods and the pascal case for graph action fields. - The parameters and the return type of the action delegate can take one of the two forms:
- No parameters and
voidas the return type:
public virtual void actionName() { ... }
- One or more parameters, the first parameter has the
PXAdaptertype, and the return type isSystem.Collections.IEnumerable:
protected virtual IEnumerable actionName(PXAdapter adapter) { ... return adapter.Get(); }
- No parameters and
The same rules apply to overrides of action delegates via the PXOverride mechanism. The only exception is that the delegate may have an additional parameter of the delegate type which represents the base delegate.
The PX1000 diagnostic checks graphs and graph extensions for action delegates whose return type and parameters do not match any of the valid signatures described above.
The PX1000 code fix changes the action delegate signature to the correct form with, as shown in the following code.
public virtual IEnumerable actionName(PXAdapter adapter)
{
...
return adapter.Get();
}For PXOverride overrides of action delegates, the code fix is not registered. This is because the change of the PXOverride method signature will break the override mechanism and make the changed override
incompatible with the base action delegate.
public class SomeEntry : PXGraph<SomeEntry, Primary>
{
public PXAction<Primary> Release = null!;
public PXAction<Primary> Report = null!;
public void release(PXAdapter adapter) // The PX1000 error is displayed for this line.
{
}
public IEnumerable report() // Another PX1000 error is displayed for this line.
{
}
}public class SomeEntry : PXGraph<SomeEntry, Primary>
{
public PXAction<Primary> Release = null!;
public PXAction<Primary> Report = null!;
public IEnumerable release(PXAdapter adapter)
{
return adapter.Get();
}
public IEnumerable report(PXAdapter adapter)
{
return adapter.Get();
}
}