Before recent upgrades, problem (see below) was happening sporadically (after 5 or 6 compiles).
Easy fix: remove all debug breakpoint(s). Compile. No error. Add back debug breakpoint(s). Compiles without error for another 5 or 6 cycles
After upgrade (R 4.3.0 and) R Studio 2023.03.0 Build 386, with breakpoints, sourcing problem is continuous.
Simple code:
line 1 yearZ <- 2023
line 2 print(yearZ)
No debug. Source. Works fine. Console shows this:
source("~/Rstuff/errDebug/blah.r")
[1] 2023
Set breakpoint at line 2. Source. Error is unavoidable,
debugSource("~/Rstuff/errDebug/blah.r")
Error in length(steps) == 0 || nchar(steps) == 0 :
'length = 2' in coercion to 'logical(1)'
I have R 4.3.0, RStudio 2023.03.0 build 386 on MacOS 13.3.1 (Intel). I tried your example several times and it debugs with no issues. Looks like your bug is not easily reproducible
It was totally reproducible with R4.3.0 and absent with R4.2.0. The error is now "gone". I chalk it up to a 4.3.0 install / registry / hmm. I will ask ChatGWudHppnd or my local NSA spook to investigate. Hey, NSA, just kidding...
Reinstalling RStudio or switching (Global Options) to 4.2.0 and back to a new reinstall of 4.3.0 (with all packages upto date, and which always requires restarting) did not "fix" it.
Finally, I added a few lines to the source code, moved the breakpoint and ... RStudio successfully "sourced" and debugged code.
rdesktop.log indicates some command failed instances ... below ... something might have been "(un)hooked" and was fixed by reinstalling/fiddling. No log entries errors after problem disappeared. Who knows
2023-05-02T01:22:38.098Z ERROR Error querying the Windows registry: Error: Command failed: %SystemRoot%\System32\reg.exe query HKEY_CURRENT_USER\SOFTWARE\R-Core\R64 /s /v InstallPath /reg:32
ERROR: The system was unable to find the specified registry key or value.
2023-05-02T01:22:38.260Z ERROR Error querying the Windows registry: Error: Command failed: %SystemRoot%\System32\reg.exe query HKEY_CURRENT_USER\SOFTWARE\R-Core\R64 /s /v InstallPath /reg:64
ERROR: The system was unable to find the specified registry key or value.
2023-05-02T01:22:38.404Z ERROR Command failed: %SystemRoot%\System32\reg.exe query HKEY_LOCAL_MACHINE\SOFTWARE\R-Core\R /v InstallPath /reg:32
ERROR: The system was unable to find the specified registry key or value.
2023-05-02T01:22:38.567Z ERROR Command failed: %SystemRoot%\System32\reg.exe query HKEY_CURRENT_USER\SOFTWARE\R-Core\R64 /v InstallPath /reg:32
ERROR: The system was unable to find the specified registry key or value.