Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 2.97 KB

File metadata and controls

52 lines (44 loc) · 2.97 KB

PX1100

This document describes the PX1100 diagnostic.

Summary

Code Short Description Type Code Fix
PX1100 An element of a graph or a DAC extension extends or overrides an obsolete code element. Warning Unavailable

Diagnostic Description

.NET Framework provides a standard way to mark a code element as obsolete by using System.ObsoleteAttribute. This attribute can be applied to classes, methods, properties, fields, events, and other code elements. When a code element is marked as obsolete, it means that the element should not be used in the new code and may be removed in future versions.

In Acumatica ERP code, public APIs are frequently marked as obsolete with System.ObsoleteAttribute. However, because C# compiler does not recognize Acumatica Framework extension mechanisms, it does not report an error when an obsolete code element is extended via this attribute. The affected scenarios include the following:

  • Override of an obsolete virtual method in a graph extension by using the PXOverride mechanism
  • Access to an obsolete protected method in a graph extension by using the PXProtectedAccess mechanism
  • Addition of a view delegate to an obsolete view
  • Addition of an action delegate to an obsolete action.
  • Customization of attributes of an obsolete DAC field property in a DAC extension
  • Customization via a cache attached event handler of a graph extension

The PX1100 diagnostic attempts to fix this issue by reporting a warning when an obsolete code element is extended or overridden via a graph or DAC extension mechanisms. The diagnostic currently detects the following scenarios:

  • Override of an obsolete virtual method in a graph extension by using the PXOverride mechanism

Example of a Method with the PXOverride Attribute Overriding the Obsolete Method

In the following example, the PXOverride method overrides an obsolete base method.

public class MyGraph : PXGraph<MyGraph>
{
	[Obsolete("This method is obsolete and will be removed in future versions.")]
	protected virtual void UpdateBalances()
	{
		// Implementation
	}
}

public class BaseGraphExtension : PXGraphExtension<MyGraph>
{
	/// Overrides <seealso cref="MyGraph.UpdateBalances()"/>
	[PXOverride]
	public void UpdateBalances(Action base_UpdateBalances)		// Report PX1100
	{
		// Implementation
	}
}

Related Articles