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

warnings for Text Overflow don't come up #5029

Closed pzentner closed 4 years ago

pzentner commented 5 years ago

With the spring release, you have longer Item Descriptions and Customer Names (and similar fields). When you create a new app using AL:Go! and then replace "HelloWorld.al" with this code, I would expect warnings about a text overflow in those two lines:

CustName := cust.Name;

ItemDesc := item.Description;

However, I do not get any warnings. I would consider this an issue when trying to rely on the dev tools to warn about issues and then not finding them.

Here is the code for HelloWorld.al. This was tested with the latest docker image on "Microsoft/bcsandbox:us", using compiler 3.0.1.41121 and AL extension version 3.0.106655.

` table 50103 "test" { Caption = 'Test'; DataClassification = SystemMetadata;

fields
{
    field(1; PrimaryKey; Code[10])
    {
        Caption = 'Primary Key';
        DataClassification = SystemMetadata;
    }
    field(2; ItemDesc; Text[50])
    {
        Caption = 'Item Description';
        DataClassification = SystemMetadata;
    }
    field(3; CustName; Text[50])
    {
        Caption = 'Customer Name';
        DataClassification = SystemMetadata;
    }
}

keys
{
    key(PK; PrimaryKey)
    {
        Clustered = true;
    }
}

procedure TestMe()
var
    cust: Record Customer;
    item: Record Item;
begin
    if cust.FindFirst() then
        CustName := cust.Name;
    if item.FindFirst() then
        ItemDesc := item.Description;
end;

} `

atoader commented 5 years ago

@pzentner have you enabled code analysis? If yes, what analyzers do you have enabled?

pzentner commented 5 years ago

@atoader yes, I do have code analysis enabled:

"al.codeAnalyzers": [
    "${AppSourceCop}",
    "${CodeCop}",
    "${UICop}"
]
atoader commented 5 years ago

Thank you for confirming! We will investigate.

MarcHansenMicrosoft commented 4 years ago

Are you sure that the analyzers are enabled?

Have this in your settings.json "al.codeAnalyzers": [ "${AppSourceCop}", "${CodeCop}", "${UICop}" ], "al.enableCodeAnalysis": true

You can verify if it is enabled by adding a new variable, this should now be shown as unused.

MarcHansenMicrosoft commented 4 years ago

image

pzentner commented 4 years ago

When I reported that 6 months ago, I did have everything enabled and it wasn't working properly. I know that it does work in the Fall release (2019 wave 2). I have not tested it with any of the old versions again

MarcHansenMicrosoft commented 4 years ago

Thanks that explains. I did a fix to this 3 months back based on another github request.

Marc