Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.25 KB

PX1045.md

File metadata and controls

33 lines (23 loc) · 1.25 KB

PX1045

This document describes the PX1045 diagnostic.

Summary

Code Short Description Type Code Fix
PX1045 PXGraph instances cannot be created in event handlers. Error Unavailable

Diagnostic Description

PXGraph instances cannot be created in event handlers.

To fix the issue, you remove the invocation of the PXGraph.CreateInstance<T>() method 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 BinExtension : PXGraphExtension<INSiteMaint>
{
    public void INLocation_RowPersisted(PXCache sender, PXRowPersistedEventArgs e)
    {
        if (e.TranStatus != PXTranStatus.Completed) return;

        var orderMaint = PXGraph.CreateInstance<SOOrderEntry>(); // The PX1045 error is displayed for this line.
    }
}

Related Articles

PXGraph