This document describes the PX1057 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1057 | A PXGraph instance cannot be initialized while another PXGraph instance is being initialized. |
Error | Unavailable |
A PXGraph instance cannot be initialized while another PXGraph instance is being initialized. The following code elements are considered to be a part of the graph initialization:
- The
PXGraphandPXGraphExtensionconstructors - The
Initializemethod overridden inPXGraphExtension - The
Initializemethod ofPXGraphthat implements thePX.Data.DependencyInjection.IGraphWithInitializationinterface - The
Configuremethod overridden inPXGraphandPXGraphExtension
To fix the issue, you should remove the initialization of the PXGraph instance from the initialization logic 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 DocCustomerExtensionMaint : PXGraph<DocCustomerExtensionMaint>
{
public DocCustomerExtensionMaint()
{
DocConnMaint maint = PXGraph.CreateInstance<DocConnMaint>(); // The PX1057 error is displayed for this line.
}
}