Use parenthesis for method calls instead of assignment syntax

Properties
FC0005 Warning Design Code Fix Ignore Obsolete

The AL compiler lets you invoke a method that takes a single parameter using assignment syntax - Customer.ReadIsolation := IsolationLevel::ReadCommitted compiles just like Customer.ReadIsolation(IsolationLevel::ReadCommitted).

Written as an assignment, a method call is visually indistinguishable from setting a value, hiding the fact that a method is being invoked.

Example

procedure UpdateCustomer(var Customer: Record Customer)
var
    CustomerMgt: Codeunit "Customer Mgt.";
begin
    Customer.ReadIsolation := IsolationLevel::ReadCommitted; // Use parenthesis for method calls instead of assignment syntax [FC0005]

    CustomerMgt.SetValue := 5; // Use parenthesis for method calls instead of assignment syntax [FC0005]
end;

codeunit 50100 "Customer Mgt."
{
    procedure SetValue(NewValue: Integer)
    begin
    end;
}

Call the method using parenthesis instead:

procedure UpdateCustomer(var Customer: Record Customer)
var
    CustomerMgt: Codeunit "Customer Mgt.";
begin
    Customer.ReadIsolation(IsolationLevel::ReadCommitted);

    CustomerMgt.SetValue(5);
end;

Why this matters

When the target of an assignment resolves to a method that takes exactly one parameter, the AL compiler rewrites Target := Source into Target(Source) — an actual method call. Both forms produce the same InvocationExpression, but the assignment form reads like a property assignment.

Today the AL Language does not have properties on objects, so the compiler lets you get away with the assignment form. If AL ever introduces real properties, a statement like MyObject.Value := 5 becomes ambiguous — is it assigning a property or calling a method? By always calling methods with parenthesis you make the intent unambiguous, both for tooling and for anyone reading your code.