Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AD0001 in specific app.json #682

Closed
Arthurvdv opened this issue Jul 8, 2024 Discussed in #680 · 8 comments
Closed

AD0001 in specific app.json #682

Arthurvdv opened this issue Jul 8, 2024 Discussed in #680 · 8 comments
Labels
bug Something isn't working Resolved

Comments

@Arthurvdv
Copy link
Collaborator

Discussed in #680

Originally posted by SorenBogelund-ECIT July 8, 2024
I have an issue with a specific app.json in a specific repository. The issue does not appear in other app.json files. For some reason 10 warnings are generated for no reason?
image

@Arthurvdv Arthurvdv added the bug Something isn't working label Jul 8, 2024
@Arthurvdv
Copy link
Collaborator Author

@SorenBogelund-ECIT, thank you for reporting this error. Not sure what's causing this at the moment, but I've added an check in the pre-release version of the LinterCop to identify the line of code responsible for this exception.

Could you switch to the pre-release version of the LinterCop look for a LC0000 diagnostic? Would be great if you could share a small code example so I could investigate this.

image

@Arthurvdv
Copy link
Collaborator Author

@SorenBogelund-ECIT, did you by any chance had the time to look into this?

@SorenBogelund-ECIT
Copy link

Hi Arthur

Do you mean like this?:

image

@Arthurvdv
Copy link
Collaborator Author

I believe this needs to be a User Setting I've never try'ed as a workspace-setting, so not sure if this works.

image

After setting this, you need to close all(!) VS Code windows and after that opening the AL project it will download the pre-release version of the LinterCop, where you should no longer have the error on the app.json, but on the specific line in the AL file.

You could also manually grab the BusinessCentral.LinterCop.dll file from the releases and override this in the %userprofile%\.vscode\extensions\ms-dynamics-smb.al-13.1.1065068\bin\Analyzers folder. It should be the pre-release version v0.30.28 of the LinterCop.

image

@SorenBogelund-ECIT
Copy link

I have done both of your suggestions:

image
image

And now I get new errors:
image

@Arthurvdv
Copy link
Collaborator Author

Arthurvdv commented Jul 12, 2024

@SorenBogelund-ECIT , thank you for providing these, this was exactly the information what I was looking for.

This should now be resolved in the (pre)release version of v0.30.28 of the LinterCop, where the error shouldn't occur anymore.

For now the LC0027 diagnostic will not be raised for this example, where I believe it should. If these are the pages are the same as the 'LookupPageId' of the entity (Table) itself, you can replace the case statement with one single line. I'll create a separate issue to look if we can the LC0027 rule to also show an diagnostic on this scenario.

EDIT: This example below isn't right I release now, sorry. This will show the ListPage of the entity with probably one single record with your example. I didn't pay attention that you're referring to the CardPage, where the Page Management codeunit defaults to the LookupPageId, which mostly returns the ListPage.

    local procedure HandleError(MyErrorInfo: ErrorInfo)
    var
        PageManagement: Codeunit "Page Management";
        RecRelatedVariant: Variant;
    begin
        RecRelatedVariant := MyErrorInfo.RecordId.GetRecord();

        // case MyErrorInfo.TableId of
        //     Database::Resource:
        //         Page.Run(Page::"Resource Card", RecRelatedVariant);
        //     Database::"Allocation Account":
        //         Page.Run(Page::"Allocation Account", RecRelatedVariant);
        //     Database::"Item Charge":
        //         Page.Run(Page::"Item Charges", RecRelatedVariant);
        //     Database::"G/L Account":
        //         Page.Run(Page::"G/L Account Card", RecRelatedVariant);
        // end;
        PageManagement.PageRun(RecRelatedVariant);
    end;

@SorenBogelund-ECIT
Copy link

Hi Arthur

It looks like, you are right, no errors:

image

Thank for the tip about the Page Management codeunit. :)

@Arthurvdv
Copy link
Collaborator Author

The version v0.30.28 of the LinterCop is now the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Resolved
Projects
None yet
Development

No branches or pull requests

2 participants