Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.29 KB

PX1071.md

File metadata and controls

30 lines (22 loc) · 1.29 KB

PX1071

This document describes the PX1071 diagnostic.

Summary

Code Short Description Type Code Fix
PX1071 Actions cannot be executed within event handlers. Error Unavailable

Diagnostic Description

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.

Example of Incorrect Code

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.
    }
}