This document describes the PX1045 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1045 | PXGraph instances cannot be created in event handlers. |
Error | Unavailable |
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
.
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.
}
}