Skip to content

Can't step into a tryCatch() (or maybe any {?) when keep.source = FALSE #14306

Closed

Description

@DavisVaughan

Should probably be tackled with #14276 because you'll already be in that headspace. As with that issue, this is quite common when debugging packages installed from CRAN, and my reprex below just fakes that experience.

eval(parse(text = "fn <- function() {
  tryCatch({
    1 + 1
    2 + 2
    3 + 3
  })
}
", keep.source = FALSE))

debugonce(fn)

fn()

Note how the line number doesn't update once we are in the try catch

This has actually annoyed me quite a bit over the years

Screen.Recording.2024-02-21.at.4.11.17.PM.mov

Activity

  1. added
    new
    on Feb 21, 2024
  2. added this to the Chocolate Cosmos milestone on Feb 22, 2024
  3. self-assigned this
    on Feb 22, 2024
  4. added and removed
    new
    on Feb 28, 2024
  5. kevinushey commented on Feb 28, 2024

    @kevinushey
    Collaborator

    Testing note: there's still an issue where the first attempt to step into the body of the tryCatch() statement doesn't update, e.g.

    Screenshot 2024-02-28 at 1 57 10 PM

    But somehow we recover on the following attempts to step through. Debugging the issue was hairy, more-so because it seemed to work on occasion when I was debugging, hinting at a possible race condition somewhere? But perhaps that's still "good enough" for this issue?

  6. self-assigned this
    on Mar 13, 2024
  7. added
    info needed
    and removed
    info needed
    on Mar 13, 2024
  8. ronblum commented on Mar 15, 2024

    @ronblum
    Contributor

    Verified using the original example in

    • RStudio Desktop 2024.04.0-daily+581 on MacOS 14.4
    • RStudio Server 2024.04.0-daily+593 on Ubuntu 22.04 via Chrome on MacOS 14.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions