Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AA0242 is thrown when "Rec.AddLoadFields" is used after "Rec.SetLoadFields" #7924

Open
2 tasks
someC0d3r opened this issue Dec 3, 2024 · 0 comments
Open
2 tasks
Labels
accepted CodeCop This is a specific static-code-analysis group (AA)

Comments

@someC0d3r
Copy link

someC0d3r commented Dec 3, 2024

1. Describe the bug
When using "AddLoadFields" after "SetLoadFields" the warning AA0242 will be thrown when the additionally added field is used.

See screenshot:

Image

I can't tell atm if this is by design or a bug - because you can also use AddLoadFields before SetLoadFields, which means SetLoadFields would overwrite the selected fields from AddLoadFields (for my understanding).

2. To Reproduce

See screenshot above

Code:

local procedure Foo()
var
    ServiceItem: Record "Service Item";
begin
    ServiceItem.Reset();
    ServiceItem.SetLoadFields(Priority);
    ServiceItem.AddLoadFields(Description);
    if not ServiceItem.FindSet() then
        exit;

    repeat
        Message(Format(ServiceItem.Priority));
        Message(ServiceItem.Description);
    until ServiceItem.Next() = 0;
end;

3. Expected behavior
AA0242 will not be thrown for line "Message(ServiceItem.Description);" as ServiceItem.Description got loaded

4. Actual behavior
AA0242 is thrown for line "Message(ServiceItem.Description);"

5. Versions:

  • AL Language: v14.1.1180850
  • Visual Studio Code: 1.95.3 (user setup)
  • Business Central: 25.1
  • List of Visual Studio Code extensions that you have installed:
    • AZ AL Dev Tools/AL Code Outline
    • BusinessCentral.LinterCop
    • NAB AL Tools
  • 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#560485

@krupybalu krupybalu added requires-triage CodeCop This is a specific static-code-analysis group (AA) accepted and removed requires-triage labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted CodeCop This is a specific static-code-analysis group (AA)
Projects
None yet
Development

No branches or pull requests

2 participants