I'm trying to set up debug configuration in visual studio code but i'm getting "Apex language server could not provide information about valid breakpoints." could you please let me know whether scratch org is necessary to set up debugger in vs code. Can you please provide steps to invoke debugger.

closed as too broad by Pranay Jaiswal, battery.cord, glls, Boris Bachovski, Himanshu Jul 31 '18 at 4:09

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I've downvoted this question due to lack of research. The answer I've given is essentially just copy/pasting information from the information included with the VSCode extension. While not a high-quality question, I don't believe this should be closed since there is a specific answer. – Derek F Jul 30 '18 at 15:11

The set up instructions on the Apex Debugger for Visual Studio Code page mentions scratch orgs on multiple occasions, so I would take that to mean that yes, a scratch org is required for debugging using visual studio code.

Further, I'd take that to mean that you can only debug scratch orgs through this tool (at time of writing).

The rest of your question seems to be directly answered by the Visual Studio Code Marketplace page for the apex debugger. Quoting directly (because links can change/go dead over time)...

Debug Your Code

Nice job! You’ve set up the Apex Debugger. Now, set breakpoints and start a debugging session. Then, debug your code.

To set a line breakpoint, open a .cls or .trigger file and click the column to the left of the line numbers. Active breakpoints are red. Inactive breakpoints are grey. You can see a list of your breakpoints in the Breakpoints panel of the Debug view.

To start a debugging session, from the configuration dropdown menu at the top of the Debug view, select Launch Apex Debugger. Then, click the green play icon (hover text: Start Debugging).

While a debugging session is in progress, any synchronous activity that runs a line of code with a breakpoint causes execution to halt at the breakpoint. While execution is paused, you can inspect the call stack and see the current values of your variables. You can also step through your code, using the Debug actions pane that appears at the top of the editor while a debugging session is in progress, and watch those values change. You can debug up to two threads at a time. For more information, see Debugging in the Visual Studio Code docs.

Set Exception Breakpoints

To make the Apex Debugger halt execution when an exception is thrown during a debugging session, set breakpoints on exceptions. When an exception breakpoint is hit, the debugger pauses on the line of code that caused the exception. The Call Stack panel in the Debug view shows the name of the exception.

To set an exception breakpoint, press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows or Linux) to open the command palette, then select Apex Debug: Configure Exceptions. The list of available exceptions includes the exceptions in the System namespace and the Apex classes in your project that extend Exception. Select an exception from the list, and then select Always break.

To see your exception breakpoints, run Apex Debug: Configure Exceptions. The top of the list shows the exception classes that have active breakpoints, labeled Always break. To remove an exception breakpoint, select an exception from the list and then select Never break.

When you close VS Code, all your exception breakpoints are removed. (Your line breakpoints, however, remain.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.