salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

Apex debugger: variables in the Watch window and in the Debug Console window don't evauluate

Open jeffb-sfdc opened this issue 3 years ago • 3 comments

Summary

When debugging using the Apex debugger, as I step through the code, I see local variables are added, but when I evaluate the variables in the Watch window, or in the Debug Console window, just the name of the variable appears, and not its value.

Steps To Reproduce:

  1. Add the following code:
@IsTest
public class test1 {
    @IsTest(SeeAllData=True)
    static void accountTest() {
        Account[] oldAccountsArray = [SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5];
        List<Account> oldAccountsList = [SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5];
        Map<Id,Account> mapOfOldAccounts = new Map<Id,Account>(oldAccountsArray);
        Account firstOldAccount = oldAccountsArray[0];
        System.debug('Well?');
    }
}
  1. Deploy the source
  2. Click the "Debug Test" link
  3. Debug the code, and add oldAccountsArray, oldAccountsList, mapOfOldAccounts, and firstOldAccount1 to the Watch window

Result: image

Expected: I expected to be able to evaluate the variables, and also be able to expand container-type variables (lists, arrays, etc...)

  1. Go to the Debug Console window, and enter each of the local variables there.

Result: image

Expected: I expected to be able to evaluate the variables, and also be able to expand container-type variables (lists, arrays, etc...)

jeffb-sfdc avatar Jun 15 '22 16:06 jeffb-sfdc

Note: this was discovered while looking into https://github.com/forcedotcom/salesforcedx-vscode/issues/4131, which is related to this.

jeffb-sfdc avatar Jun 15 '22 16:06 jeffb-sfdc

This issue has been linked to a new work item: W-11363893

git2gus[bot] avatar Jun 29 '22 15:06 git2gus[bot]

I just hit this bug

Is there any solution for this? Nobody has been able to properly watch variables in VS Studio for over 18 months now?

jeromegv avatar Jan 31 '24 05:01 jeromegv