Internal procedure not referenced

Properties
LC0052 Warning Design Code Fix Ignore Obsolete

When a procedure is marked internal, it can only be called from within the same extension. If nothing in the extension references it, the procedure is dead code — future maintainers must read and work around it, but it can never run. The same applies to public procedures inside an object with Access = Internal, since the object’s access level effectively makes them extension-internal.

Remove the procedure if it is no longer needed, or add the missing reference.

Example

codeunit 50100 "Sales Validator"
{
    internal procedure ValidateDiscount(Discount: Decimal) // Internal procedure not referenced [LC0052]
    begin
    end;

    procedure PostSalesOrder(Discount: Decimal)
    begin
    end;
}

Add the missing call to resolve the diagnostic:

codeunit 50100 "Sales Validator"
{
    internal procedure ValidateDiscount(Discount: Decimal)
    begin
    end;

    procedure PostSalesOrder(Discount: Decimal)
    begin
        ValidateDiscount(Discount);
    end;
}

Alternatively, remove the procedure entirely if it is no longer needed.

When the diagnostic is reported

  • An internal procedure is declared but never called anywhere within the extension.
  • A public procedure in an object with Access = Internal is declared but never called within the extension.

Exception

internalsVisibleTo

When internalsVisibleTo is configured in app.json, internal procedures become accessible to the listed apps. The rule does not trigger for any procedure in the extension when this property has entries:

{
    "internalsVisibleTo": [
        {
            "id": "1bd24efc-5912-4ded-b970-a57e9d02cb55",
            "publisher": "MyPublisher",
            "name": "App Name"
        }
    ]
}

ErrorInfo and Notification parameters

Internal procedures with a single parameter of type ErrorInfo or Notification are excluded. These signatures are typically callback handlers invoked by the platform — for example, notification action handlers or actionable error fix-it actions — which have no direct call site in AL code.

See also

  • LC0053 — Internal procedure only used in current object