Skip to content

[WIP] Fix PerTenantExtensionCop not flagging fields/enum values - #8314

Closed
Thaddeus Loke (thloke) with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-pertenantextensioncop-issue
Closed

[WIP] Fix PerTenantExtensionCop not flagging fields/enum values#8314
Thaddeus Loke (thloke) with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-pertenantextensioncop-issue

Conversation

Copilot AI commented Aug 17, 2026

Copy link
Copy Markdown

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>PerTenantExtensionCop not flagging fields/enum values outside of app's defined id range</issue_title>
<issue_description><!--
Read the contributing https://github.com/microsoft/AL/blob/master/CONTRIBUTING.md guide before proceeding

Please follow this template in order for our developers to investigate your issue efficiently.

Do not edit or remove the titles; e.g. "Describe the bug".

Use the latest version of the AL language extension from the Visual Studio Code Marketplace or shipped as part of the AL Developer Preview builds for Dynamics 365 Business Central.

Disable all extensions except the AL Language extension.

-->

Please include the following with each issue:

1. Describe the bug
The PerTenantExtensionCop is not producing errors if you add a field or enum value outside of your apps extension range.

2. To Reproduce
Steps to reproduce the behavior:

  1. Used AL:Go to create a new project. Downloaded symbols from Sandbox.
  2. Used default app.json with an object range of 50100..50149
  3. Added settings.json inside .vscode folder that enables the PerTenantExtensionCop
{
        "al.enableCodeAnalysis": true,
        "al.codeAnalyzers": [
            "${PerTenantExtensionCop}"
        ]
}
  1. Created a table extension for the Customer table. Added a field with the ID 60000 which is inside the PTE range, but outside the range of IDs for this app.
tableextension 50100 CustomerTableExt extends Customer
{
    fields
    {
        field(60000; "Active"; Boolean)
        {
            Caption = 'Active';
            DataClassification = CustomerContent;
        }
    }
}
  1. Build and deploy app to Sandbox. It publishes successfully, even though you have fields outside of your app range.

3. Expected behavior
When adding a field or enum value outside of your app's ID range, I would expect to receive an error (like you do when enabling the AppSourceCop).

Current Work Around - As someone developing a PTE, I wouldn't expect to need to leverage the AppSourceCop (and disable warnings) JUST so I can get effective warnings about developers on our team using fields and enums IDs outside of our app's range.

  1. Add "${AppSourceCop}" to settings.json
{
        "al.enableCodeAnalysis": true,
        "al.codeAnalyzers": [
            "${PerTenantExtensionCop}",
            "${AppSourceCop}"
        ]
}
  1. When you build, you are now getting AppSourceCop errors.
    The error that is helpful is the following:
error AS0013: The field identifier '60000' is not valid. It must be within the range '[50100..50149]', which is allocated to the application, and outside the range '[50000..99999]', which is allocated to per-tenant customizations.

I would like to see the first part of the error message be displayed when using the PerTenantExtensionCop

4. Actual behavior
A clear and concise description of what happened accompanied by images, animations, or a link to a video showing the issue occurring

This is problematic, as we could have multiple PTEs being installed, which in theory, we are expecting to maintain their own object range. If we do not receive any errors, you do not realize fields are added outside of the app range, and then it's a huge pain to clean up.

5. Versions:

  • AL Language: 17.0.2273547
  • Visual Studio Code: 1.133.0
  • Business Central: US Business Central 28.3 (Platform 28.0.53152.0 + Application 28.3.52162.53387)
  • List of Visual Studio Code extensions that you have installed: AL Language Extension
  • Operating System:
    • Windows
    • Linux
    • MacOS

Final Checklist

Please remember to do the following:

  • Search the issue repository to ensure you are reporting a new issue

  • Reproduce the issue after disabling all extensions except the AL Language extension

  • Simplify your code around the issue to better isolate the problem
    </issue_description>

<agent_instructions>Triage issue #8313. Post exactly one standardized public triage comment, make no repository changes, and do not create a pull request.</agent_instructions>

Comments on the Issue (you are Copilot in this section)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PerTenantExtensionCop not flagging fields/enum values outside of app's defined id range

2 participants