MATLAB-extension-for-vscode icon indicating copy to clipboard operation
MATLAB-extension-for-vscode copied to clipboard

Still can't access local variables after changing call stack depth

Open robertoffmoura opened this issue 7 months ago • 4 comments

Hi, this is a follow up to this issue. The particular example described in that issue has been fixed, but I'm still experiencing instances of this bug. I was able to reproduce this issue with another example.

To Reproduce Create a new file named function1.m and paste the following content:

function function1()
    a1 = 1;
    function2();
end

function function2()
    a2 = 2;
    disp("hm");
end
  1. Add a brekpoint on line 8 (the disp statement)
  2. type function1 in the terminal to execute the program
  3. Click function1 in the call stack, then click function2 in the call stack, and then finally click function1 in the call stack. Type a1 in the terminal
  4. See error Unrecognized function or variable 'a1'

Expected behavior a1 should be accessible since we changed the context back to function1, where it was defined.

Useful Information MATLAB Version: 24.2.0.2740171 (R2024b) Update OS Version: Red Hat Enterprise Linux 8.10 VS Code Version: 1.98.2 Extension Version: 1.3.3

robertoffmoura avatar Jul 11 '25 15:07 robertoffmoura

Thanks for reporting this issue. This definitely looks like something we would want to resolve. However, so far, I have not able to reproduce the issue. Is this something that is fully reproducible for you every time in a brand new session of vs code with a brand new instance of MATLAB? Or is it something that sporadically happens?

philipb314 avatar Jul 14 '25 13:07 philipb314

Hi Philip, Yes, I'm able to fully reproduce this 100% every time, with brand new sessions of vs code and MATLAB.

robertoffmoura avatar Jul 14 '25 17:07 robertoffmoura

Hi Robert, I have been looking into this again and even when replicating your environment (MATLAB, OS, VS Code, and extension versions) from above to the best of my ability, I have not been able to reproduce it. It shouldn't be platform dependent anyway, but I wanted to make sure.

That makes me think that there must be some slight difference in workflow between us that is having an effect here. Would you be willing to create a screen capture of this issue being reproduced from the start and attach it to this issue?

philipb314 avatar Sep 18 '25 15:09 philipb314

Hi Philip,

Of course. Please see the screen capture attached: https://github.com/user-attachments/assets/af35c174-2e46-46be-a29a-895ae81ddb00

This also happens when using VS Code connected to a remote using SSH:

MATLAB Version: '24.2.0.2740171 (R2024b) Update 1' VS Code Version: 1.85.2 (system setup) Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681 Date: 2024-01-18T06:40:10.514Z Electron: 25.9.7 ElectronBuildId: 26354273 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045 Extension Version: 1.3.6

robertoffmoura avatar Nov 06 '25 10:11 robertoffmoura

Hi,

It looks like the issue only happens when I connect to a remote through SSH.

robertoffmoura avatar Nov 22 '25 20:11 robertoffmoura