This document describes the PX1040 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1040 | Instance constructors in BLC extensions are strictly prohibited. You should use the Initialize() method instead. |
Error | Available |
Instance constructors cannot be used in graph extensions. Instead of using instance constructors, you must override the Initialize()
method.
The code fix moves the code from the constructor to the Initialize()
method.
public class ARReleaseProcess_Extension : PXGraphExtension<ARReleaseProcess>
{
public ARReleaseProcess_Extension() : base() // The PX1040 error is displayed for this line.
{
UnityInitializer.InitializeUnityContainer();
_dataService = Bootstap.Instance.Unity.Resolve<IAcumaticaDataService>();
}
}
public class ARReleaseProcess_Extension : PXGraphExtension<ARReleaseProcess>
{
public override void Initialize()
{
UnityInitializer.InitializeUnityContainer();
_dataService = Bootstap.Instance.Unity.Resolve<IAcumaticaDataService>();
}
}