AL icon indicating copy to clipboard operation
AL copied to clipboard

Copies wrong sql statement

Open BrianThorChristensen opened this issue 3 years ago • 0 comments

Please include the following with each issue:

1. Describe the bug When you debug and have enableSqlInformationDebugger: true or enableLongRunningSqlStatements: true in launch.json you get the databasestatistics section in the debugger pane. Here you can select a statement, right click and copy, but it seems that no matter which statement you copy, you always get the statement from SQL0.

2. To Reproduce Steps to reproduce the behavior:

  1. Add enableSqlInformationDebugger: true and enableLongRunningSqlStatements: true to launch.json
  2. Add a breakpoint anywhere in code after a few database reads.
  3. Start debugging.
  4. Execute the code to hit the breakpoint.
  5. Expand the database statistics in the debugger pane.
  6. Expand any statement except SQL0.
  7. Select the sql statement.
  8. Right click and select copy.
  9. Paste the statement anywhere.
  10. Now you will notice that you didn't paste the selected sql statement.
page 50001 "MyPage"
{
    Caption = 'mypage';
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Administration;

    actions
    {
        area(Processing)
        {
            action(ActionName)
            {
                ApplicationArea = All;

                trigger OnAction()
                var
                    Customer: Record Customer;
                    Vendor: Record Vendor;
                    i:Integer;
                begin
                    Customer.Get('10000');
                    Vendor.Get('10000');
                    i:=0; //Set breakpoint here
                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**
I expect that the correct sql statement is copied.

**4. Actual behavior**
Notice the sql statement in SQL9:
![Skærmbillede 2022-09-15 152626](https://user-images.githubusercontent.com/31523525/190416311-a989a0d8-672c-4f86-881b-9ef19677b6d6.png)

Select and copy.
![Skærmbillede 2022-09-15 152656](https://user-images.githubusercontent.com/31523525/190416272-75d42895-19dc-4e6a-963f-9fbd6805a752.png)

Paste and you get:
![Skærmbillede 2022-09-15 152729](https://user-images.githubusercontent.com/31523525/190416161-6759a824-e74f-468f-9b21-6bc1dcc7e0af.png)

...a different sql statement. (SQL0)

**5. Versions:**

- AL Language: v9.4.663067
- Visual Studio Code: 1.71.1
- Business Central: 20.2.41144.41959
- List of Visual Studio Code extensions that you have installed:
Al Language

BrianThorChristensen avatar Sep 15 '22 13:09 BrianThorChristensen