microsoft / microsoft/AL

Cannot debug OnOpenPage and OnInit of Report's request page

Open
#8,171 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accepted
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

Please include the following with each issue:

1. Describe the bug
When setting a breakpoint within the onopenpage trigger it will never stop and be caught, even though the code is executing.

2. To Reproduce
Steps to reproduce the behavior:

  1. Create a new report.
  2. Add the request page area.
  3. Add an OnOpenPage and OnInit trigger.
  4. Add an OnInitReport trigger (global).
  5. Add simple code in each.
  6. Add a breakpoint.
  7. Deploy and debug.
  8. Don't hit breakpoints.
  9. OnInitReport will be hit, but has about a 25% chance to crash the debugger, more common with actual complex reports.
report 50100 "Example Report"
{
    Caption = 'Example';
    ApplicationArea = All;
    UsageCategory = ReportsAndAnalysis;

    requestpage
    {
        trigger OnInit()
        begin
            // cannot debug
            Message('trigger OnInit');
        end;
        trigger OnOpenPage()
        begin
            // cannot debug
            Message('trigger OnOpenPage');
        end;
    }

    trigger OnInitReport()
    begin
        // often, not always, crashes the debugger
        Message('trigger OnInitReport');
    end;
}

Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.

3. Expected behavior
Break to allow debugging and do not crash debugger.

4. Actual behavior
Doesn't break or debugger stops leading to "debugger stopped the current action" message within BC.

5. Versions:

  • AL Language: 16.2.1869542
  • Visual Studio Code: 1.106.3 (system setup)
  • Business Central: 26.0 and 27.0, probably more.
  • List of Visual Studio Code extensions that you have installed: AL Language.
  • Operating System:
    • Windows
    • Linux
    • MacOS
Final Checklist

Please remember to do the following:

  • Search the issue repository to ensure you are reporting a new issue

  • Reproduce the issue after disabling all extensions except the AL Language extension

  • Simplify your code around the issue to better isolate the problem

Internal work item: AB#617345

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AL report and request-page triggers in the issue's reproduction snippet, then run the listed deployment and debug steps in Visual Studio Code. Compare breakpoint behavior for OnInit and OnOpenPage with OnInitReport, including the reported debugger crash. Done means both request-page triggers break reliably and the debugger does not stop the current action unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.