Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.68 KB

PX1059.md

File metadata and controls

36 lines (26 loc) · 1.68 KB

PX1059

This document describes the PX1059 diagnostic.

Summary

Code Short Description Type Code Fix
PX1059 Changes to PXCache cannot be performed during the PXGraph initialization. Error Unavailable

Diagnostic Description

Changes to PXCache cannot be performed during the PXGraph initialization (that is, in PXGraph constructors, in the Initialize method overridden in PXGraphExtension, or in handlers subscribed at run time through the static InstanceCreated member of PXGraph).

The diagnostic finds invocations of the following methods:

  • The Insert, Update, and Delete methods of the PXCache object
  • The Insert, Update, and Delete methods of decendants of the PXSelectBase<> class

The invocation of these methods during the PXGraph initialization can lead to data inconsistency.

During the PXGraph initialization, you can configure basic UI presentation logic and can make sure that all necessary configuration data for the screen is available. No other business logic should be executed during the PXGraph initialization.

To prevent the error from occurring, you should remove from the PXGraph initialization the code that changes PXCache and rework the related business logic.

Example of Incorrect Code

public class SOOrderEntry : PXGraph<SOOrderEntry>
{
    public SOOrderEntry()
    {
        var doc = Orders.Current;
        doc.OrderType = "SO";
        Orders.Cache.Update(doc); //The PX1059 error is displayed for this line.
    }
}