Runtime bug in query that should be checked by compilator/codecops
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 881
- Forks
- 285
- Avg merge
- 3d 36m
- Merged PRs (30d)
- 1
Description
When query field is used for in MaxStrLen function it raise runtime error that is visible in Application Event Log. BC Webclient raise only something wrong.
Error say that field can't be used before Read.
Code example:
MyQuery.SetRange(ResourceNo, "Resource No.");
MyQuery.SetFilter(Department, '<>%1', CopyStr(HelpDepartments, 1, MaxStrLen(MyQuery.Department)));
MyQuery.Open();
while MyQuery.Read() do begin
I understand that read is necessary when we work with data, but for determining text size is new for me.
Please add to compilator check that field is not used before read. It helps with runtime error that developer do not see.
Problem was that function and query was used long time, but warning said that there is overflow in text. So when we solved warning we created new error in runtime.
Thank you
Internal work item: AB#580025
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the AL query example and the MaxStrLen(MyQuery.Department) expression, then trace how compiler diagnostics handle query fields before Read. Done means the compiler reports this misuse before runtime, with coverage for the demonstrated case; no source file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100