Casing mismatch (FC0002)

AL is case-insensitive, but consistent casing improves readability and professionalism. When referencing identifiers (variables, procedures, fields, etc.), the casing should match the original declaration.

This rule detects when the casing of a reference differs from its declaration.

A code fix is available for this diagnostic.

Example

The following code has casing mismatches:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure()
    var
        CustomerName: Text;
    begin
        customername := 'Test'; // Casing mismatch [FC0002]
        MYPROCEDURE(); // Casing mismatch [FC0002]
    end;
}

To fix this, use consistent casing that matches the declaration:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure()
    var
        CustomerName: Text;
    begin
        CustomerName := 'Test';
        MyProcedure();
    end;
}

XmlPort vs Xmlport casing

The AL language intentionally uses different canonical casings for xmlports depending on the context. FC0002 follows the compiler’s own canonical names (the same names the AL Language extension’s IntelliSense suggests) rather than enforcing a single spelling:

ContextCanonical casingExample
Object declarationxmlportxmlport 50100 "My Xmlport"
Variable, parameter, or return typeXmlPortMyPort: XmlPort "My Xmlport";
Static class methods (Run, Import, Export)XmlportXmlport.Run(...)
Object access (left of ::)XmlportXmlport::"My Xmlport"
ObjectType option memberXmlPortObjectType::XmlPort

For example, this code is fully canonical, even though the same word appears in three different casings:

xmlport 50100 "My Xmlport"
{
    // ...
}

codeunit 50100 MyCodeunit
{
    procedure RunIt(MyPort: XmlPort "My Xmlport")
    begin
        Xmlport.Run(Xmlport::"My Xmlport");
    end;
}

Writing XmlPort.Run(XmlPort::"My Xmlport") triggers FC0002 on the :: expression, because the compiler’s built-in class symbol behind both the static methods and the :: object access is named Xmlport.