Duplicate source file displays when debuggibng with breakpoints

If I set a breakpoint in a package function, then when execution hits that breakpoint, a SECOND COPY of the same source file is displayed in the code window. I can then step through, etc. with that window (I'll call that the "second version".) However, the red dot with the breakpoint stays in the original copy of the file. When debugging is over, the second copy stays open.

Associated notes:

  • If I debug again, it does not display yet a third version if I havbe left the second version open.
  • If I unset the breakpoint in the first version, it doesn't trace anymore.
  • If I set a new breakpoint in the second version, it ignores any breakpoints in the first version (but does not remove the red dot). The red dot appears in the second version.
  • The second version "sticks" in the sense that if I keep it displayed and close the first version, I can set and unset breakpoints in it and not have additional windows come up. However, if I disable all breakpoints in it and close it, then reopen the file, I am back to square one with a second version being displayed the first time I make and hit a breakpoint.

This is mostly annoying because it is disorienting and creates clutter. However, it can be more pernicious. For example, if I edit the first version of the file, those changes are not shown in the second version. And if I edit the second version of the file, I get an error message: ERROR: cannot remove earlier installation, is it in use?

I have tried restarting the system. I have tried upgrading to the latest version of RStudio. I have tried disabling and then re-enabling the --with-keep.source flag. None of this changes the behavior.

I cannot provide a reproducible example. This just started happening. If I swith to another project, I don't get the same behavior. When I switch back to the project where this happens, it happens again. So it is project-related.

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: 1.3.1056
  • OS Version: Windows 10 NT (x86_64-w64-mingw32/x64)
  • R Version: 4.0.1
  • sessionInfo():
R version 4.0.1 (2020-06-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mgcv_1.8-31         nlme_3.1-148        emmeans_1.4.8090005

loaded via a namespace (and not attached):
 [1] statmod_1.4.34      tidyselect_1.1.0    zoo_1.8-8           xfun_0.14           purrr_0.3.4        
 [6] splines_4.0.1       lmerTest_3.1-2      lattice_0.20-41     generics_0.0.2      colorspace_1.4-1   
[11] vctrs_0.3.1         htmltools_0.4.0     yaml_2.2.1          survival_3.1-12     rlang_0.4.6        
[16] rsm_2.10            nloptr_1.2.2.1      pillar_1.4.4        glue_1.4.1          multcomp_1.4-13    
[21] lifecycle_0.2.0     plyr_1.8.6          munsell_0.5.0       gtable_0.3.0        bdsmatrix_1.3-4    
[26] mvtnorm_1.1-0       codetools_0.2-16    coda_0.19-3         evaluate_0.14       coxme_2.2-16       
[31] knitr_1.28          pbkrtest_0.4-8.6    parallel_4.0.1      TH.data_1.0-10      Rcpp_1.0.4.6       
[36] xtable_1.8-4        scales_1.1.1        lme4_1.1-23         ggplot2_3.3.1       packrat_0.5.0      
[41] digest_0.6.25       dplyr_1.0.0         numDeriv_2016.8-1.1 grid_4.0.1          tools_4.0.1        
[46] sandwich_2.5-1      magrittr_1.5        tibble_3.0.1        crayon_1.3.4        pkgconfig_2.0.3    
[51] MASS_7.3-51.6       ellipsis_0.3.1      Matrix_1.2-18       estimability_1.3    minqa_1.2.4        
[56] rmarkdown_2.2       rstudioapi_0.11     R6_2.4.1            boot_1.3-25         compiler_4.0.1  

Referred here from support.rstudio.com

I figured out what was happening. I had assigned a drive letter H: (via the old DOS subst command) to a subdirectory of My Documents. The project history had disappeared a couple of weeks ago so I started RStudio up again by double-clicking on the project file in File Explorer, to which I had navigated using the H: path. The when debugging, the other copy of the file was obtained from the My Documents path. I reloaded the project from the latter, and the problem went away!