Using base::browser() to debug and develop

Hi. I've found base::browser() extremely useful when develop (also debugging) shiny-apps.
I often use browser() inside a shiny::moduleServer() to develop further as this allows me to have all of the environment variables coming from input and other reactives very quickly (Working extremely well with shiny::reactiveConsole(TRUE)).
However, when writing something in console or either run some code the browser() functionality keeps sending me to a temporary file with message in top: "Debug location is approximate because the source is not available".

Is there any way to disable this behavior or maybe I've missed out on a similar functionality that is build for this

I've tried to create a reprex below:

char_names <- 
  c("run1",
    "run2",
    "run3",
    "run4")

purrr::map(char_names, .f = function(.x) {
  base::browser()
  paste(.x, "some more text .....")
})

I am also experiencing this, and it worsened after a recent upgrade to RStudio 2021.09.0.

To restate what happens exactly: Adding a browser() call inside a function or a reactive environment in a Shiny app is super handy to debug because once the browser() triggers, you can interact with the local environment and the reactive values.

However, since recently, every time you run some code while being in "Browser mode", even basic code like 1+1, a new tab opens which is a temporary file with Debug location is approximate because the source is not available.

This is not helpful at all. This temporary file can't even be edited. To continue working, you have to close it, go back to where you were, until you run the next command. And when you run the next command, the temporary file opens again. If you run 50 commands, you'll have to go through this cycle 50 times, which is incredibly frustrating.

Here is a short video that illustrates the issue: Link to video. Notice how whenever I type something, the temporary file opens and disrupt everything.

Whenever I work on a complex Shiny app, I spend most of my time in "Browser mode" because it is so handy to debug but also code from scratch, having access to the reactive inputs/variables. This new feature/bug makes it next to impossible.

Thank you for the restate this is the exact problem I face as well and I've seen it worsened since upgrade of RStudio.

Let me know if you find a solution elsewhere

Why don't you create a feature request?

The same is also discussed here and here.

1 Like

I am experiencing the same problem

I've created a GitHub issue here: https://github.com/rstudio/rstudio/issues/10011

1 Like

Thanks Andreas!

According to the labels, it seems to have been taken into account (for 2023 though, so we'll have to be patient). Hopefully we can have it earlier.

In the meantime, I found that installing an older version fixes the issue: Older Versions of RStudio - RStudio

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.