Internal events must include XML documentation comments
A developer adds an internal event procedure to a codeunit and decorates it with [InternalEvent(false)], expecting the event name and parameters to speak for themselves. For consumers of the extension — including other extensions that can see internal members via InternalsVisibleTo — the event appears in IntelliSense with no description, no parameter hints, and no guidance on when it is raised or how it should be handled.
Add XML documentation comments
to describe the event, or restrict it to local scope if it is not meant to be part of the internal API surface.
Example
The following event is internal and lacks XML documentation:
codeunit 50100 MyCodeunit
{
[InternalEvent(false)]
local procedure OnBeforeCalculateInternalTotal(Quantity: Decimal; UnitPrice: Decimal; var IsHandled: Boolean) // Internal events must include XML documentation comments [DC0010]
begin
end;
}Add XML documentation to describe the event’s purpose and parameters:
codeunit 50100 MyCodeunit
{
/// <summary>
/// Raised before an internal total calculation is performed, allowing internal subscribers to override the default logic.
/// </summary>
/// <param name="Quantity">The number of units used in the internal calculation.</param>
/// <param name="UnitPrice">The price per unit used in the internal calculation.</param>
/// <param name="IsHandled">
/// Set to <c>true</c> by subscribers to indicate that the internal calculation has been handled and the default logic should be skipped.
/// </param>
[InternalEvent(false)]
local procedure OnBeforeCalculateInternalTotal(Quantity: Decimal; UnitPrice: Decimal; var IsHandled: Boolean)
begin
end;
}If the event is not meant to be consumed by other objects, restrict its scope instead or limit or remove the internalsVisibleTo setting in your app.json file (see app.json file
).
When the diagnostic is reported
- The procedure is decorated with
[InternalEvent()]. - The procedure has no XML documentation comments.
- The containing object has an accessibility of
Public.
Code documentation comments
The AL Language extension has built-in IntelliSense support for XML documentation comments
: typing /// above an event procedure generates a template with <summary> and <param> 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. Internal event procedures in test codeunits do not require XML documentation.