microsoft / microsoft/AL

Error when publishing a case with type Joker

Open
#7,832 1 comment 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

Please include the following with each issue:

1. Describe the bug
When creating a switch case on a value of the type joker, the compiler will not throw an error, but publishing the App will.

2. To Reproduce
Steps to reproduce the behavior:

  1. Create a case on a value of Type Joker
procedure Example()
    var
        RecordRef: RecordRef;
        newFieldRef: FieldRef;
    begin

        RecordRef.Close();
        RecordRef.Open(77);
        if RecordRef.FindFirst() then begin
            newFieldRef := RecordRef.Field(3);
            case newFieldRef.Value of
                1:
                    Message('Hello');
            end;
        end;

    end;
  1. Publish

3. Expected behavior
Either the compiler throws an error immediatly, or i can successfully publish.

4. Actual behavior
The compiler throws neither Error nor Warning, but on publish i get:

The request for path /BC/dev/apps?tenant=default&SchemaUpdateMode=synchronize&DependencyPublishingOption=default failed with code UnprocessableEntity. Reason: Failure while emitting method. Object:'Codeunit Example' Method:'Example()' (Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind')
Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind'

5. Versions:

  • AL Language: 13.1.1065068
  • Visual Studio Code: 1.92.2
  • Business Central: DE Business Central 24.4 (Plattform 24.0.23374.0 + Anwendung 24.4.22295.23403)
  • List of Visual Studio Code extensions that you have installed:AL Language
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#546897

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 by reproducing the AL example using RecordRef, FieldRef, and a switch case on a Joker value, then inspect the compiler path that handles the case expression and the publishing/emission failure. Done means the compiler reports the invalid construct before publishing or the application publishes successfully without the unexpected Joker NavTypeKind error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.