This document describes the PX1116 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1116 | A graph extension or a DAC extension has a circular reference in its type hierarchy. | Error | Unavailable |
The PX1116 diagnostic detects and reports graph extensions and DAC extensions that have circular references in their type hierarchy. Circular references occur when an extension directly or indirectly references itself through its base extensions, creating a cycle in the type hierarchy diagram of the extension.
The term extension type hierarchy has a specific meaning within the Acumatica Framework that is different from the regular C# type hierarchy.
In Acumatica Framework, extensions can extend other extensions through two mechanisms:
- Inheritance (only for graph extensions): When a graph extension class directly inherits from another graph extension class (for example,
class ExtensionB : ExtensionA). The inheritance is forbidden for DAC extensions. - Chaining also called higher-level extension: When an extension declares other extensions as type parameters in the base generic extension type (for example,
class ExtensionA : PXGraphExtension<ExtensionB, MyGraph>).
The extension type hierarchy in Acumatica Framework is a set of all types extended by the extension through these two mechanisms. This hierarchy can be represented as a diagram where nodes are extension types, and edges represent "extends" relationships (either through inheritance or chaining). Such diagram cannot contain cycles, otherwise the extension type hierarchy has circular references. Circular references in the extension type hierarchy prevent Acumatica Framework from correctly instantiating and initializing extensions at runtime. This results in the runtime error.
public class MyGraph : PXGraph<MyGraph>
{
// Business logic
}
// ExtensionA chains ExtensionB
public class ExtensionA : PXGraphExtension<ExtensionB, MyGraph> // Reports PX1116
{
// Extension logic
}
// ExtensionB chains ExtensionC
public class ExtensionB : PXGraphExtension<ExtensionC, MyGraph> // Reports PX1116
{
// Extension logic
}
// ExtensionC chains ExtensionA - creating a circular reference
public class ExtensionC : PXGraphExtension<ExtensionA, MyGraph> // Reports PX1116
{
// Extension logic
}[PXHidden]
public class MyDac : PXBqlTable, IBqlTable
{
// DAC fields
}
// ExtensionA chains ExtensionB
public sealed class ExtensionA : PXCacheExtension<ExtensionB, MyDac> // Reports PX1116
{
// Extension logic
}
// ExtensionB chains ExtensionC
public sealed class ExtensionB : PXCacheExtension<ExtensionC, MyDac> // Reports PX1116
{
// Extension logic
}
// ExtensionC chains ExtensionA - creating a circular reference
public sealed class ExtensionC : PXCacheExtension<ExtensionA, MyDac> // Reports PX1116
{
// Extension logic
}