編輯

AppSourceCop Warning AS0075

Attribute reason must be set.

Description

Attribute reason must be set.

Remarks

When an object, element, variable, or procedure is marked with Obsolete or RequiredPending, you should also specify a reason. The reason provides valuable information -- such as why the change is happening or a workaround -- to developers who reference the element. For Obsolete, the reason appears in AL0432 and AL0433. For RequiredPending, it appears in AL0924.

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.

When the attribute RequiredPending is used, you need to specify the Reason 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