microsoft / AL

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
744 stars 245 forks source link

[still] no compile/runtime warning if SetLoadFields()/AddLoadFields() are passed fields of wrong type #6862

Closed dzzzb closed 2 years ago

dzzzb commented 2 years ago

https://github.com/microsoft/AL/issues/6480 was closed. But there is still no warning in 19.1. I don't have access to an Insider build or time to figure out how to get one. But @PhDuck said this should get resolved. So reopening.

pageextension 50100 "Customer List" extends "Customer List"
{
    actions
    {
        addfirst(processing)
        {
            action(Test)
            {
                ApplicationArea = All;
                Caption = 'Test';
                Image = TestFile;
                Promoted = true;
                PromotedCategory = Process;
                PromotedOnly = true;
                ToolTip = 'Do a test.';

                trigger OnAction()
                var
                    Customer: Record Customer;
                begin
                    Customer.SetLoadFields("Sales (LCY)", "Balance (LCY)");
                    Customer.Get(Rec."No.");
                    Customer.TestField("Sales (LCY)");
                    Customer.TestField("Balance (LCY)");
                end;
            }
        }
    }
}

image

Name: AL Language
Id: ms-dynamics-smb.al
Description: AL development tools for Dynamics 365 Business Central
Version: 8.2.550913
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al
thloke commented 2 years ago

Reading the old issue, I there was some discussion on implementing a warning, but no actual action taken to implement the warning. I'll accept it so it's tracked internally so we don't lose it again.

To summarize the previous discussion, the intent is to add a new warning in CodeCop to detect usages of non-normal field types in [Set/Add]LoadFields.

dzzzb commented 2 years ago

Great, thank you!

thloke commented 2 years ago

Unfortunately the team that owns this feature has no plans on implementing the warning, as they have other more high priority bugs to fix. In this case, closing this issue as a "won't fix".