Error during publish when EventSubscriber have parameter RecRef
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
I have similar behavior as described in https://github.com/microsoft/AL/issues/7832. I can compile my code and everything looks good. Problem raise when I publish application to database (OnPrem server)
2. To Reproduce
Steps to reproduce the behavior:
- Create new appliction
- Create new object
codeunit 55007 "Item Templ. Mgt. EH TRT"
{
SingleInstance = true;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Templ. Mgt.", OnInitFromTemplateOnBeforeValidateFields, '', false, false)]
local procedure OnInitFromTemplateOnBeforeValidateFields(var FieldValidationList: List of [Integer]; var ItemTemplRecRef: RecordRef)
begin
end;
}
- Compile application
- Publish application to DB
3. Expected behavior
Publish will be without problems
4. Actual behavior
Publish-NavApp raise error:
One or more errors occurred. (Failure while emitting method. Object:'Codeunit "Item Templ. Mgt. EH TRT"' Method:'OnInitFromTemplateOnBeforeValidateFields(var List of [Integer], var RecordRef)' (Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind'))
Failure while emitting method. Object:'Codeunit "Item Templ. Mgt. EH TRT"' Method:'OnInitFromTemplateOnBeforeValidateFields(var List of [Integer], var RecordRef)' (Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind')
Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind'
5. Versions:
- AL Language: 15.2.1630495
- Visual Studio Code:
Version: 1.102.1 (user setup)
Commit: 7adae6a56e34cb64d08899664b814cf620465925
Date: 2025-07-15T16:41:17.147Z
Electron: 35.6.0
ElectronBuildId: 11847422
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Windows_NT x64 10.0.26100 - Business Central: 26.3.36158.36321
- 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#595958
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
Reproduce the failure with the shown EventSubscriber containing a var RecordRef parameter, then publish the compiled application with Publish-NavApp against the stated Business Central environment. Done means the application publishes successfully without the 'Unexpected value Joker' emission error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100