Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 1.4 KB

File metadata and controls

42 lines (33 loc) · 1.4 KB

PX1046

This document describes the PX1046 diagnostic.

Summary

Code Short Description Type Code Fix
PX1046 Long-running operations cannot be started within event handlers. Error Unavailable

Diagnostic Description

Long-running operations cannot be started within event handlers.

To fix the issue, you remove the invocation of the long-running operation and rework the related business logic.

Example of Incorrect Code

public class BinExtension : PXGraphExtension<INSiteMaint>
{
    public void INLocation_RowPersisted(PXCache sender, PXRowPersistedEventArgs e)
    {
        if (e.TranStatus != PXTranStatus.Completed) return;

        try
        {
            PXLongOperation.StartOperation(this, delegate () // The PX1046 error is displayed for this line.
            {
                //export records
            });
        }
        catch (Exception ex)
        {
            PXTrace.WriteError($"INLocation_RowPersisted - Failed. {ex}");
        }
    }
}

Related Articles