Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.4 KB

PX1040.md

File metadata and controls

40 lines (31 loc) · 1.4 KB

PX1040

This document describes the PX1040 diagnostic.

Summary

Code Short Description Type Code Fix
PX1040 Instance constructors in BLC extensions are strictly prohibited. You should use the Initialize() method instead. Error Available

Diagnostic Description

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.

Example of Incorrect Code

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>();
    }

}

Example of Code Fix

public class ARReleaseProcess_Extension : PXGraphExtension<ARReleaseProcess>
{
    public override void Initialize()
    {
        UnityInitializer.InitializeUnityContainer();
        _dataService = Bootstap.Instance.Unity.Resolve<IAcumaticaDataService>();
    }
}