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
719 stars 242 forks source link

Unexpected warning AS0098 when adding an enumextension to an enum within the same AppSource app #7714

Closed Jeeve65 closed 1 month ago

Jeeve65 commented 2 months ago

1. Describe the bug In a single AppSource app we have an Enum object and an EnumExtension to that Enum. The enumextension adds a new value. Here we get warning AS0098 The identifier 'HasIssue' must have at least one of the mandatory affixes 'YYY' - which does not pop up for values in the original Enum.

2. To Reproduce Steps to reproduce the behavior:

  1. Create a new app.
  2. In app.json, define an id range within the AppSource area:
    "idRanges": [ { "from": 74000000, "to": 74000000 } ],
  3. Enable code analysis and the "${AppSourceCop}" analyzer
  4. In the app folder, create a file AppSourceCop.json containing:
    { "mandatoryPrefix":"YYY" }
  5. Create the following objects: enum 74000000 "YYY AS0098 issue" { Extensible = true;

    value(0; "No Issue") { Caption = 'No Issue'; } } enumextension 74000000 "YYY AS0098 issue extension" extends "YYY AS0098 issue" { value(1; HasIssue) { Caption = 'Has Issue'; } }

3. Expected behavior No warning. Since the extension is within the app, and extending a proprietary object, there is no added value to start values with the app prefix.

4. Actual behavior A warning pops up: The identifier 'HasIssue' must have at least one of the mandatory affixes 'YYY'. AL(AS0098) [Ln 3, Col 14]

5. Versions:

BazookaMusic commented 2 months ago

Looks like a bug

Jeeve65 commented 2 months ago

By the way, BcContainerHelper's Run-ALValidation reports this issue as AS0011