Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.74 KB

PX1044.md

File metadata and controls

47 lines (33 loc) · 1.74 KB

PX1044

This document describes the PX1044 diagnostic.

Summary

Code Short Description Type Code Fix
PX1044 Changes to PXCache cannot be performed in event handlers. Error Unavailable

Diagnostic Description

The Insert, Update, and Delete methods cannot be invoked on any PXCache object in the following event handlers:

  • FieldDefaulting
  • FieldVerifying
  • RowSelected
  • RowSelecting

These event handlers are designed for different purposes.

We recommend that you not invoke the Insert, Update, and Delete methods on a PXCache object in the following event handlers:

  • RowInserting
  • RowUpdating
  • RowDeleting

Changes to PXCache in these event handlers can lead to data inconsistency.

To prevent the error from occurring, you should remove the invocation of the Insert, Update, or Delete method of PXCache from the event handler and rework the related business logic.

This diagnostic is displayed for the RowInserting, RowUpdating, and RowDeleting event handlers only if the Enable additional diagnostics for ISV Solution Certification option (in Tools > Options > Acuminator > Code Analysis) is set to True.

Example of Incorrect Code

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
	protected virtual void _(Events.RowSelecting<SOOrder> e)
	{
		var setup = SelectSetup();
		Base.Caches[typeof(SOSetup)].Insert(setup); // The PX1044 error is displayed for this line.
	}
}

Related Articles

PXCache