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
732 stars 243 forks source link

Expression this.CurrPage does not resolve in pageextensions #7822

Open christian-clausen opened 4 weeks ago

christian-clausen commented 4 weeks ago

1. Describe the bug

In pageextensions, this.CurrPage fails with a compilation error:

'Page MyPage' does not contain a definition for 'CurrPage'

This is rather strange, as CurrPage does resolve in both the page in the pageextension, so this.CurrPage should also resolve.

2. To Reproduce Steps to reproduce the behavior:

  1. Write this code
page 50100 MyPage
{
    trigger OnOpenPage()
    begin
        this.SaveRecord();
        CurrPage.SaveRecord();
        this.CurrPage.SaveRecord();
    end;
 }

pageextension 50100 MyPageExtension extends MyPage
{
    trigger OnOpenPage()
    begin
        this.SaveRecord();
        CurrPage.SaveRecord();
        this.CurrPage.SaveRecord(); // 'Page MyPage' does not contain a definition for 'CurrPage'(AL0847)
    end;
}
  1. Observe the compilation error.

3. Expected behavior I would expect this.CurrPage to resolve as CurrPage resolves.

4. Actual behavior The code fails with compilation error error AL0847: 'Page MyPage' does not contain a definition for 'CurrPage'

image

5. Versions:

Final Checklist

BazookaMusic commented 3 weeks ago

From the code example, it seems there's a mismatch between pages and page extensions.