AL icon indicating copy to clipboard operation
AL copied to clipboard

Expression this.CurrPage does not resolve in pageextensions

Open christian-clausen opened this issue 1 year ago • 1 comments

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:

  • AL Language: Latest preview release - 14.0.1070882
  • Visual Studio Code: 1.92.1
  • Business Central: 25
  • List of Visual Studio Code extensions that you have installed: ms-dynamics-smb.al

Final Checklist

  • [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

christian-clausen avatar Aug 16 '24 13:08 christian-clausen

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

BazookaMusic avatar Aug 17 '24 22:08 BazookaMusic