microsoft / microsoft/AL

Bug in warning AL0885/AL0836 looping with AL0254

Open
#8,265 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accepted
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

1. Describe the bug
Looping warning without solution.

I have action that open page with source table "Capacity Ledger Entry".

RunObject = page "Capacity List ISH";
RunPageLink = "Order No." = field("No.");
RunPageView = sorting("Order No.", "Order Line No.", "Routing No.", "Routing Reference No.", "Operation No.", "Last Output Line");

line with sorting generate warning: Sorting field 'Routing No.' should be part of the keys for table 'Capacity Ledger Entry'. Add the field to a key definition to improve performance AL0254. Other fields are mentioned also.

When I create table extension for "Capacity Ledger Entry" with required key

    keys
    {
        key("Key55000 ISH"; "Scrap Unresolved ISH") { }
        key("Scrap ISH"; "Order Type", "Order No.", "Order Line No.") { }
        key("Key1ISH"; "Order No.", "Order Line No.", "Routing No.", "Routing Reference No.", "Operation No.", "Last Output Line") { }
    }

I get warning: The Key 'Key1ISH' contains a reference to the field 'Routing No.' which is defined in another object from the same app. If you are preparing to move this object to another extension in the future, this reference will be an issue.

When I remove the key, I'm back at the beginning.

The "Capacity Ledger Entry" is table from Base Application so it should work. Same information are in BC web client where fields are part of one table.

Main problem is that standard table "Capacity Leger Entry" is from 2 objects: table "Capacity Ledger Entry" and tableextension "Mfg. Capacity Ledger Entry". Both are part of "Base Application". This is problem probably reason why we get warning about fields in keys. It is OK now, but runtime 18 will raise error and it will be problem.

2. To Reproduce
Steps to reproduce the behavior:

  1. Create Page with source table "Capacity Leger Entry"
  2. Set
sorting("Order No.", "Order Line No.", "Routing No.", "Routing Reference No.", "Operation No.", "Last Output Line");
  1. You will get warning AL0254
  2. Create table extension for "Capacity Leger Entry" and create key
key("Key1ISH"; "Routing No.") { }
  1. You will get warning``` ALAL code snippet that demonstrates the issue or a link to a code repository the developers can easily pull down to recreate the issue locally.

**Note:** Because the developers need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.

**3. Expected behavior**
Tables created in one application have to be taken as one table and doesn't matter if is in code created as one object or more. Compiler create one object co it have to be same for warnings.

**4. Actual behavior**
warnings take care about source code inside application and raise false positive warning.

**5. Versions:**

- AL Language: 17.0.2273547
- Visual Studio Code: 1.121.0
- Business Central: BC28 CU01
- List of Visual Studio Code extensions that you have installed:
- Operating System:
  * [x] Windows
  * [ ] Linux
  * [ ] MacOS

### Final Checklist

Please remember to do the following:

* [x] Search the issue repository to ensure you are reporting a new issue

* [x] Reproduce the issue after disabling all extensions except the AL Language extension

* [x] Simplify your code around the issue to better isolate the problem

Internal work item: [AB#642037](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/642037)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AL0254 reproduction using a page over "Capacity Ledger Entry" and the listed sorting fields, then compare it with the table extension keys that trigger the AL0885/AL0836 warning. Investigate how the compiler treats fields split between the base table and its tableextension; done means the reproduction no longer produces a false-positive warning or an unsatisfiable warning loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.