Diagnostic AL0192 incorrectly reported when using Cookie.Name(...) or Cookie.Value(...) as setters
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 881
- Forks
- 285
- Avg merge
- 3d 36m
- Merged PRs (30d)
- 1
Description
1. Describe the bug
Using Cookie.Name([Name: Text]): Text or Cookie.Value([Value: Text]): Text as a setter (using parentheses) incorrectly triggers diagnostic AL0192:
The return value must be used for the method 'Name'
According to the method signature and tooltip, passing a Text argument sets the corresponding property of the Cookie. The same setter-style syntax is supported by both Name and Value.
For example:
MyCookie.Name('dummyname');
MyCookie.Value('dummyvalue');
Both statements currently trigger AL0192 because their return values are not used, even though the methods are intentionally being called as setters.
2. To Reproduce
local procedure SetCookieData()
var
MyCookie: Cookie;
begin
MyCookie.Name('dummyname'); // AL0192: The return value must be used for the method 'Name'
MyCookie.Value('dummyvalue'); // AL0192: The return value must be used for the method 'Value'
end;
3. Expected behavior
AL0192 should not be reported when Cookie.Name(...) or Cookie.Value(...) is called with an argument and therefore used as a setter.
This should behave similarly to functions such as CurrPage.Caption, which can be assigned either using direct assignment:
CurrPage.Caption := 'Test';
or by using the setter syntax:
CurrPage.Caption('Test');
Calling Cookie.Name('test') or Cookie.Value('test') should therefore be considered a valid setter call without requiring the returned value to be consumed.
4. Actual behavior
AL0192 is reported for both setter calls:
5. Versions
- AL Language: 17.0.2273547
- Visual Studio Code:
Version: 1.135.0 (system setup)
Commit: 08d4889f9ec4a1685d257b9b95de036c8e1ce1e5
Date: 2026-08-25T14:26:52Z
Electron: 42.8.1
ElectronBuildId: 14906494
Chromium: 148.0.7778.280
Node.js: 24.18.1
V8: 14.8.178.38-electron.0
@GitHub/copilot: 1.0.81-0
@GitHub/copilot-sdk: 1.0.11
OS: Windows_NT x64 10.0.26200
-
Business Central: /
-
Installed Visual Studio Code extensions:
- AL Language Extension
- ALCops
-
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
Internal work item: AB#649119
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 AL0192 diagnostic handling and reproduce the issue using the provided SetCookieData procedure. Check how Cookie.Name(...) and Cookie.Value(...) calls with arguments are classified, then add or update regression coverage so setter calls no longer report AL0192 while value-returning calls still require their results to be used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100