AppSourceCop Warning AS0075

Obsolete Reason must be set.

Description

Obsolete Reason must be set.

Remarks

When an object, element, variable or procedure is marked as obsolete, you should also specify an obsolete reason. The obsolete reason can be used to provide valuable information, such as the reason for the obsoletion or a workaround to achieve the same goal, to developers that are referencing it. The obsolete reason appears in the message of the diagnostics AL0432 and AL0433 reported by the AL compiler when referencing obsolete elements.

How to fix this diagnostic?

When the property Obsolete State is used to mark an object as Obsolete Pending or Obsolete Removed, you need to also specify the property Obsolete Reason.

When the attribute Obsolete is used, you need to specify the obsolete reason attribute parameter.

Code examples triggering the rule

Example 1 - Table marked as Obsolete Pending

table 50100 MyTable
{
    ObsoleteState = Pending;

    fields
    {
        field(50100; MyField; Integer) { }
    }
}

Example 2 - Procedure marked as Obsolete

codeunit 50100 MyCodeunit
{
    [Obsolete]
    procedure MyProcedure()
    begin
        // Business logic.
    end;
}

Code examples not triggering the rule

Example 1 - Table marked as Obsolete Pending

table 50100 MyTable
{
    ObsoleteState = Pending;
    ObsoleteReason = 'This table is being deprecated for reason X. Use table Y instead.';

    fields
    {
        field(50100; MyField; Integer) { }
    }
}

Example 2 - Procedure marked as Obsolete

codeunit 50100 MyCodeunit
{
    [Obsolete('This procedure is being deprecated for reason X. Use procedure Y instead.')]
    procedure MyProcedure()
    begin
        // Business logic.
    end;
}

AppSourceCop Analyzer
Get Started with AL
Developing Extensions