microsoft / microsoft/AL

Runtime Error when using a Record variable as a dynamic expression for an action or a page field property

Open
#7,849 2 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

I'm hoping to get #6992 fixed this time.

1. Describe the bug
Missing warning or error when assigning a record variable (other than Rec!) for a page field or action property, mainly Enabled and Editable. This leads to a BC runtime error message later.

2. To Reproduce
For actions:
see #6992 .

For page fields:
On a page, define a global record variable GlobalRecVar.
Then add the Editable property to some field:

field(SomeField; Rec.SomeField)
{
    Editable = GlobalRecVar.SomeOtherField;
}

3. Expected behavior
A warning or error should be raised.

4. Actual behavior
No warning or error.
When the code is published and the page is run on the client, a runtime error will occur:

The identifier 'GlobalRecVar.SomeOtherField' could not be found.

This should be prevented.

5. Versions:

  • AL Language: v13.1.1065068
    Internal work item: AB#625881

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 issue #6992 and reproduce the page-field example using GlobalRecVar.SomeOtherField in an Editable property. Compare the missing diagnostic with the later client runtime error; done means the compiler or language tooling reports a warning or error before publication for this invalid record-variable expression.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.