Internal procedures must include XML documentation comments

Properties
DC0006 Hidden Design Code Fix Ignore Obsolete

A developer adds an internal procedure to a codeunit, expecting the procedure name and parameters to speak for themselves. For consumers of the extension — especially those without access to the source code — the procedure appears in IntelliSense with no description, no parameter hints, and no return-value documentation. They are left to guess at its purpose, preconditions, and guarantees.

Add XML documentation comments to describe the procedure, or restrict it to local scope if it is not meant to be part of the public API.

Example

The following procedure is internal and lacks XML documentation:

codeunit 50100 MyCodeunit
{
    internal procedure CalculateTotal(Quantity: Decimal; UnitPrice: Decimal): Decimal // Internal procedures must include XML documentation comments [DC0006]
    begin
        exit(Quantity * UnitPrice);
    end;
}

Add XML documentation to describe the procedure’s purpose, parameters, and return value:

codeunit 50100 MyCodeunit
{
    /// <summary>
    /// Calculates the total price based on quantity and unit price.
    /// </summary>
    /// <param name="Quantity">The number of units.</param>
    /// <param name="UnitPrice">The price per unit.</param>
    /// <returns>The total price.</returns>
    internal procedure CalculateTotal(Quantity: Decimal; UnitPrice: Decimal): Decimal
    begin
        exit(Quantity * UnitPrice);
    end;
}

If the procedure is not meant to be called externally, restrict its scope instead or limit or remove the internalsVisibleTo setting in your app.json file (see app.json file ):

codeunit 50100 MyCodeunit
{
    local procedure CalculateTotal(Quantity: Decimal; UnitPrice: Decimal): Decimal
    begin
        exit(Quantity * UnitPrice);
    end;
}

When the diagnostic is reported

  • The procedure has no local keyword or is public and it is not contained in an object with Access = Internal.
  • The procedure has no XML documentation comments.

Code documentation comments

The AL Language extension has built-in IntelliSense support for XML documentation comments : typing /// above a procedure generates a template with <summary>, <param>, and <returns> tags matching the signature. Code documentation comments are available since Business Central 2020 Release Wave 2 (version 17) .

Exception

Test codeunits (Subtype = Test) are exempt. Procedures in test codeunits — including test methods and handler methods — do not require XML documentation.

See also

  • DC0004 — Public procedures must include XML documentation comments
  • DC0005 — XML documentation must match the procedure signature