Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
728
stars
241
forks
source link
Missing parenthesis in Enum methods throws error in platform but not in compilation time #7629
1. Describe the bug
Missing parenthesis in Enum methods throws error in platform but not in compilation time.
2. To Reproduce
Steps to reproduce the behavior:
Create an Enum
enum 70021 "ABC Sale Type"
{
value(0; A) {}
value(1; B) {}
}
Add this code
Txt := Enum::"ABC Sale Type".Names.Get(Enum::"ABC Sale Type".Ordinals.IndexOf(1))
3. Expected behavior
AL compiler should throw a clear error because error is thrown later in platform.
4. Actual behavior
You can compile but an error is thrown when you try to publish: Unexpected value 'NoConversion' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.ConversionKind') Unexpected value 'NoConversion' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.ConversionKind'
5. Solution:
Add parenthesis to Names() method and Ordinals() methods
Txt := Enum::"ABC Sale Type".Names().Get(Enum::"ABC Sale Type".Ordinals().IndexOf(1))
6. Versions:
AL Language: I guess 12.1
Visual Studio Code: 1.85.1
Business Central: 23.1
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
1. Describe the bug Missing parenthesis in Enum methods throws error in platform but not in compilation time.
2. To Reproduce Steps to reproduce the behavior:
3. Expected behavior AL compiler should throw a clear error because error is thrown later in platform.
4. Actual behavior You can compile but an error is thrown when you try to publish: Unexpected value 'NoConversion' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.ConversionKind') Unexpected value 'NoConversion' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.ConversionKind'
5. Solution: Add parenthesis to Names() method and Ordinals() methods
6. Versions:
Final Checklist
Please remember to do the following: