Public objects must include XML documentation comments
A developer creates a public object, assuming its name will be self-explanatory. For consumers of the extension — especially those without access to the source code — the object appears in IntelliSense with no description and no indication of its purpose or intended usage. They are left to guess when and how to use the object safely.
Add XML documentation comments to describe the object, its responsibilities, and any important usage guidance, or restrict its access if it is not meant to be part of the public API.
Example
The following object is public and lacks XML documentation:
codeunit 50100 MyCodeunit // Public objects must include XML documentation comments [DC0007]
{
Access = Public;
// [...]
}Or, when Access is omitted, the object is public by default:
codeunit 50100 MyCodeunit // Public objects must include XML documentation comments [DC0007]
{
// [...]
}Add XML documentation to describe the object’s purpose:
/// <summary>
/// Provides functionality for calculating totals and exposing related business logic.
/// </summary>
codeunit 50100 MyCodeunit
{
// [...]
}When the diagnostic is reported
- The object has no
Accessproperty or is declared withAccess = Public. - The object has no XML documentation comments immediately preceding its declaration.
Code documentation comments
The AL Language extension has built-in IntelliSense support for XML documentation comments
: typing /// above an object declaration generates a template with a <summary> tag. Code documentation comments are available since Business Central 2020 Release Wave 2 (version 17)
.
Exception
Test objects (for example, test codeunits with Subtype = Test) are exempt. Public test objects do not require XML documentation.