AL icon indicating copy to clipboard operation
AL copied to clipboard

Automatic variable "Return Value" missing in VSCode Debugger Variables -> Locals

Open MODUSCarstenScholling opened this issue 2 months ago • 7 comments

1. Describe the bug At some point back in time, the AL Language extension provided an automatic variable called "Return Value" in Variables -> Locals, every time the procedure end was hit by the debugger.

However, this variable is missing since a longer time (see screenshot).

Image

2. To Reproduce

  • Debug an app, a procedure with return value,
  • go single step until end of procedure,
  • Review the Variables -> Locals section
procedure GetValue(): Text
begin
    exit('Any Value');
end; // hitting this should show "Return Value" with content 'Any Value'

3. Expected behavior Hitting procedure end with the debugger should show "Return Value" with content 'Any Value' in Variables -> Locals.

4. Actual behavior "Return Value" is not shown in Variables -> Locals when hitting procedure end in debugger.

5. Versions:

  • AL Language: 17.0.1825603
  • Visual Studio Code: 1.104.3
  • Business Central: 27.0
  • Operating System:
    • [X] Windows
    • [ ] Linux
    • [ ] MacOS

Internal work item: AB#611557

MODUSCarstenScholling avatar Oct 15 '25 05:10 MODUSCarstenScholling

The same here. Even if you name the return value, i.e. procedure GetValue()returnValue: Text begin retrnValue := 'Any Value'; end;

You can't see the returnValue value. Nor in the debugger panel, nor in the bottom panel, nor hovering over the variable.

TeconNavBC avatar Oct 15 '25 05:10 TeconNavBC

The same here. Even if you name the return value, i.e. procedure GetValue()returnValue: Text begin retrnValue := 'Any Value'; end;

You can't see the returnValue value. Nor in the debugger panel, nor in the bottom panel, nor hovering over the variable.

This is related to #8061 and should be already resolved?

NKarolak avatar Oct 15 '25 06:10 NKarolak

This is related to #8061 and should be already resolved?

It is not resolved in the version I mentioned above.

MODUSCarstenScholling avatar Oct 15 '25 06:10 MODUSCarstenScholling

The same here. Even if you name the return value, i.e. procedure GetValue()returnValue: Text begin retrnValue := 'Any Value'; end; You can't see the returnValue value. Nor in the debugger panel, nor in the bottom panel, nor hovering over the variable.

This is related to #8061 and should be already resolved?

Was this resolved also for versions 25 and 26 or is it just for the 27? Because I can't see it neither in 25 and 26 and I don't have 27 available to test

Liniik avatar Oct 15 '25 11:10 Liniik

It's not per BC version, but your AL Language version (which I'm assuming is the latest one? If we're unlucky, it's even solved in the Pre-Release version only), and often but not always in combination with the runtime version as per app.json.

NKarolak avatar Oct 15 '25 11:10 NKarolak

@NKarolak is correct that, generally speaking, the main factor is the version of the AL Language extension for VSCode. However, this specific fix did require a change in the Business Central platform, so the availability of the fix in #8061 does somewhat depend on which version of BC you are targeting.

That said, this ticket mentions VSCode extension 17.0.1825603 and BC 27.0, which is a combination that should have been fixed via work done for #8061. I will raise this internally to see if we missed something when fixing the previous bug.

EmilDamsbo avatar Oct 16 '25 11:10 EmilDamsbo

The named return variable should work and show up in the locals from 27. I'll investigate if there is an issue with it.

krupybalu avatar Oct 30 '25 08:10 krupybalu