This document describes the PX1071 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1071 | Actions cannot be executed within event handlers. | Error | Unavailable |
Actions cannot be executed within event handlers. The execution of actions in event handlers breaks the sequence of events, and subsequent event handlers can be skipped, which can lead to unpredictable system behavior.
To prevent the error from occurring, you should remove the execution of the action from the event handler and rework the related business logic.
This diagnostic is displayed as a warning if the Enable additional diagnostics for ISV Solution Certification option (in Tools > Options > Acuminator > Code Analysis) is set to False
.
public class SOOrderEntry : PXGraph<SOOrderEntry, SOOrder>
{
public PXAction<SOOrder> Release;
protected virtual void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
Release.Press(); // The PX1071 error is displayed for this line.
Cancel.Press(new PXAdapter(...)); // Another PX1071 error is displayed for this line.
}
}