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
730 stars 243 forks source link

AppSourceCop is not throwing an error for 'OptionMembers' Change #6078

Closed Rambabu-Billuri closed 3 years ago

Rambabu-Billuri commented 4 years ago

Describe the bug We are not getting an error if we try to modify or add new options to the 'OptionMembers' even the AppSourceCop and CodeCop are active.

But we are getting a failure as breaking change in Microsoft Technical Validations. Please find the below for MS Technical Validation issue.

Failed to compile package: .vscode/AL%20Files/Table%20Extensions/Tab5740-Ext70174915.Transfer%20Header%20PSE.al(143,25): error AS0044: OptionMembers has changed value from ' ,,Prepaid,Third Party Billing,,,' to ' ,Prepaid and Charge,Prepaid,Third Party Billing,Collect,Consignee Billed,Bill Recipient', this is a destructive change, only appending new OptionMembers is allowed.

To Reproduce Steps and to reproduce the behavior:

  1. Create New field of type 'Option' in TableExtension and give some options.
  2. Go to Settings in VS Code -> Extensions -> Settings.json
  3. Activate 'AppSourceCop' and 'CodeCop'
  4. Modify the existing options in 'OptionMembers'

Expected behavior AppSourceCop should identify this issue and throw an error.

4. Versions:

NKarolak commented 4 years ago

I believe you did not configure the AppSourceCop to compare code with the old app version: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/appsourcecop#configuration

atoader commented 4 years ago

Can you confirm that you configured AppSourceCop properly? Can you share a project to reproduce the issue?

Rambabu-Billuri commented 4 years ago

Yes, we configured AppSourceCop, added the old version in /.alpackages and we have given old app details in AppSourceCop.json

Here is the details in settings.json image

NKarolak commented 4 years ago

Your AppSourceCop.json is not in the project's root folder, but in subfolder .codeAnalysis.

Rambabu-Billuri commented 4 years ago

We tried by moving the AppSourceCop.json file to root folder, but we didn't get any error and the new app installed successfully.

NKarolak commented 4 years ago

Did you restart VS Code or "Reload window" after the change? Just a guess ...

Rambabu-Billuri commented 4 years ago

Yes we tried with "Reload window" and "Restart", still we didn't get the error while installing the new app.

Rambabu-Billuri commented 4 years ago

@qutreson any updates on this ?

NKarolak commented 4 years ago

Oh, good you're reminding me. What I didn't know: the correct settings apparently do not provide instant errors, but only on publishing the actual app. Have you already tried that?

Rambabu-Billuri commented 4 years ago

Yes.

qutreson commented 3 years ago

Hi @Rambabu-Billuri, I tried reproducing this scenario, but without success as I am getting the AS0044 diagnostic reported when introducing a breaking change on the OptionMembers property.

I created an extension containing the following table in version 1.0.0.0:

table 10000000 FOO_MyTable
{
    fields
    {
        field(1; MyOptionField; Option)
        {
            DataClassification = SystemMetadata;
            OptionMembers = Yes,No,Maybe;
        }
    }
}

And containing the following table in version 2.0.0.0:

table 10000000 FOO_MyTable
{
    fields
    {
        field(1; MyOptionField; Option)
        {
            DataClassification = SystemMetadata;
            OptionMembers = Yes,None,Maybe; // No has been replaced by None
        }
    }
}

I am now getting this AppSourceCop analyzer diagnostic in VS Code:

image

You can find attach the full project I used here: Github6078.zip

You can use it to verify that the AppSourceCop is correctly configured in your project. It is important to have:

If that did not help resolving this issue, can you share the project that you are using, or another one that could help reproducing the issue?

Rambabu-Billuri commented 3 years ago

Thank you so much @qutreson. We tried as you specified in the given project, it is working fine. AppSourceCop is throwing an error this time.