forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
953 stars 406 forks source link

Apex Replay Debugger not showing the content of variables correctly #5719

Open albarivas opened 3 months ago

albarivas commented 3 months ago

Summary

Trying to debug some Apex code, Apex replay debugger does not show the content of some variables, while System.debug does.

Steps To Reproduce:

Try to debug this code:

public with sharing class NewsletterGenerator {
    @AuraEnabled
    public static String generateNewsletter(String eventId) {
        Map<String, String> event = new Map<String, String>();
        event.put('id', eventId);

        ConnectApi.WrappedValue eventValue = new ConnectApi.WrappedValue();
        eventValue.value = event;

        System.debug('ALBA debug:' + event);
        System.debug('ALBA debug:' + eventValue);

        return '';
    }
}

Expected result

event and eventValue should show a value inside the replay debugger panel, same as I can see the value of those variables through system.debug:

Screenshot 2024-08-12 at 15 59 11

Actual result

Screenshot 2024-08-12 at 15 59 43

Additional information

Feel free to attach a screenshot.

Salesforce Extension Version in VS Code: v61.8.1

Salesforce CLI Version: 2.53.6

OS and version: Mac OS 14.6.1 (23G93)

VS Code version: Version: 1.92.1 (Universal)

Most recent version of the extensions where this was working:

svc-idee-bot commented 3 months ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

CristiCanizales commented 3 months ago

Hi @albarivas, I have not been able to reproduce this issue. When you mention you're trying to debug some apex code, what are the exact steps you follow for the same?

diyer commented 3 months ago

Hi @albarivas, can you provide us with your debug log to see what is going on?

albarivas commented 3 months ago

What I did was:

1- Deployed the NewsletterGenerator class (with a few more lines after the code I pasted, that are not important for debugging) 2-Started the apex replay debugger 3-Launched an action on my org that called the class 4-Downloaded the debug log (attached) 5- Launched apex replay debugger with the log file

And then I got the result you see on the screen, the event variable looks empty in the replay debugger, while if you take a look at the system.debug statement on the debug log it's not.

07L4U00003r7nT3UAI.log

Let me know if it helps!

CristiCanizales commented 3 months ago

I was able to repro with that log file. My question now though is if in step 2 you meant you started Apex Interactive Debugger, is that the case?

albarivas commented 3 months ago

@CristiCanizales it's the apex replay debugger, started capturing logs is probably more correct :)

git2gus[bot] commented 3 months ago

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

CristiCanizales commented 3 months ago

I was able to reproduce this issue and have created a Bug ⬆️ to address it. Thank you for bringing it to our attention!