microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
728 stars 241 forks source link

False positive from AS0034: Not allowed to change `InherentPermissions` property of `table` object #7586

Closed rvanbekkum closed 9 months ago

rvanbekkum commented 9 months ago

Please include the following with each issue:

1. Describe the bug In v1.0 of our extension we have the InherentPermissions property applied to a table object. If we try to change the value of the InherentPermissions property for this table object in a next version, then AS0034 throws the follow error diagnostic:

error AS0034: The property 'InherentPermissions' for Table '<My Table Name>' has changed from value 'RX' to value 'RmX'. This is not allowed because it will break upgrade of existing installations and dependent extensions.

(Please also see: https://www.yammer.com/dynamicsnavdev/#/Threads/show?threadId=2534529863409664)

Quentin TresontaniWednesday at 11:40 AM I agree, this looks like a bug. Can you log this on Github? Issues · microsoft/AL (github.com)

2. To Reproduce Steps to reproduce the behavior:

  1. Have the following property values on an AL table object in the v1 version of your extension:
table 51000 ABC_MyTable
{
    Access = Public;
    Caption = 'My Table';
    DataPerCompany = false;
    InherentPermissions = RX;

    fields
    {
        field(1; Code; Code[20])
        {
            Caption = 'Code';
            DataClassification = CustomerContent;
            NotBlank = true;
        }
        field(2; Description; Text[250])
        {
            Caption = 'Description';
            DataClassification = CustomerContent;
        }
    }

    keys
    {
        key(PK; Code)
        {
            Clustered = true;
        }
    }
}
  1. In a v2 of your extension try to change the property value of the InherentPermissions property of the same table object to a different value, e.g.:
table 51000 ABC_MyTable
{
    Access = Public;
    Caption = 'My Table';
    DataPerCompany = false;
    InherentPermissions = RmX;

    fields
    {
        field(1; Code; Code[20])
        {
            Caption = 'Code';
            DataClassification = CustomerContent;
            NotBlank = true;
        }
        field(2; Description; Text[250])
        {
            Caption = 'Description';
            DataClassification = CustomerContent;
        }
    }

    keys
    {
        key(PK; Code)
        {
            Clustered = true;
        }
    }
}
  1. Rule AS0034 (from the AppSourceCop) will raise an error diagnostic:
error AS0034: The property 'InherentPermissions' for Table 'ABC_MyTable' has changed from value 'RX' to value 'RmX'. This is not allowed because it will break upgrade of existing installations and dependent extensions.

3. Expected behavior No error diagnostic is raised by AS0034 when only the InherentPermissions is changed. This should not be considered as breaking (but of course changes should be applied with care).

4. Actual behavior An error diagnostic is raised by AS0034 when only the InherentPermissions is changed.

5. Versions:

Final Checklist

Please remember to do the following:

JesperSchulz commented 9 months ago

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 24.0.14036.0 and VS Code Extension Version 13.0.901531.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://freddysblog.com/2020/06/25/working-with-artifacts/