Apex Debugger Considerations

Don’t be surprised if you encounter these potential “gotchas” when using the Apex Debugger.
  • If you edit Apex classes while a debugging session is in progress, your breakpoints might not match your debugging output after you save your changes.
  • Your debugging session is orphaned when you close Eclipse before stopping your session. If you have an orphaned session, you can’t start a new session.
  • Eval functionality isn’t available.
  • Hot swapping isn’t permitted. These actions kill your debugging session.
    • Installing or uninstalling a package
    • Saving changes that cause your org’s metadata to recompile
      You can’t save changes to these items during a debugging session.
      • Apex classes or triggers
      • Visualforce pages or components
      • Lightning resources
      • Permissions or preferences
      • Custom fields or custom objects
  • These entry points aren’t supported.
    • Asynchronously executed code, including asynchronous tests

      Test code between a pair of startTest and stopTest methods can run synchronously. To debug your asynchronous functionality, use these methods within your tests.

      Note

    • Batch, Queueable, and Scheduled Apex
    • Inbound email
    • Code with the @future annotation
  • Keep these things in mind when working with breakpoints.
    • You can’t set conditional breakpoints.
    • Breakpoints set on a get or set method must be within the method’s body.
    • You can’t set breakpoints in or step through Execute Anonymous blocks. However, when you hit a breakpoint using Execute Anonymous, we show your Execute Anonymous frame in the stack. To view your Execute Anonymous code’s variables, click this line in the stack.
  • Keep these things in mind when working with variables.
    • You can’t watch variables.
    • Variable inspection in dynamic Visualforce and Lightning components isn’t supported.
    • You can’t drill into the instance variables of Apex library objects. To view these objects’ contents, use their toString methods.
    • Variables declared within a loop are visible outside of the loop.
    • Drill into variables to see their children’s values. For example, if you run the query [SELECT Id, ContactId, Contact.accountId, Contact.Account.ownerId FROM Case], your results are nested as follows.
    • When you perform a SOQL query for variables from the EntityDefinition table, your results include the durableId even if you don’t explicitly SELECT that variable.