microsoft / RTVS

R Tools for Visual Studio.
MIT License
389 stars 118 forks source link

Plotting in RTVS will disconnect session #4325

Open jichavez3 opened 6 years ago

jichavez3 commented 6 years ago

Running any plot in RTVS will stop my R session. Using RTVS version 1.3.40517.1016 in VS2017 Community.

From event viewer: Faulting application name: Microsoft.R.Host.exe, version: 1.3.31012.1601, time stamp: 0x5afdb984 Faulting module name: Microsoft.R.Host.exe, version: 1.3.31012.1601, time stamp: 0x5afdb984 Exception code: 0xc0000005 Fault offset: 0x000000000007b038 Faulting process id: 0x1cb0 Faulting application start time: 0x01d40c26ad8903b2 Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\R Tools for Visual Studio\Microsoft.R.Host.exe Faulting module path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\R Tools for Visual Studio\Microsoft.R.Host.exe Report Id: cabb97fa-b6f1-484e-b30c-fd60f39e865b Faulting package full name: Faulting package-relative application ID:

What I see in R: plot(1:100)

Interactive Window is disconnected from R session. Click "Reset" to start a new session.

R session is stopped. Click "Reset" to start a new one. Starting R session...

huguesv commented 6 years ago

What if you open a plot window (R Tools->Plots->New Plot Window) after the Interactive window started, but before issuing the plot command?

What distro+version of R are you using?

jichavez3 commented 6 years ago

I just tried that, and actually just opening the plot window disconnects my session. I've also had it where I keep the plot window docked, then try issuing a plot command, same result.

I'm using R version 3.5, though I've also tried it with 3.4.3 (which was the last version I used in 2015 when it worked). I've installed VS2015 to see if that was the issue, then tried Microsoft R Client 3.3.2. Neither worked.

To make sure my version of R works, I've issued the same commands in RStudio, with the plots working fine.

jichavez3 commented 6 years ago

Is there anywhere else I can post this issue? I've exhausted options, from here on github, to the VS community. Any help would be greatly appreciated.

jichavez3 commented 6 years ago

Update: I see now that any new plot window will only ever display "R Plot - Device 0" when I open a new plot window or try plotting from R Interactive. On systems where I have RTVS working (different laptop), it always has a positive integer. Is there a way to make RTVS use a correct plotting device?

smortaz commented 6 years ago

Hi. I’ll ping the dev to see if he can provide a fix or workaround. Stay tuned.

On Sun, Jul 22, 2018 at 6:42 PM jichavez3 notifications@github.com wrote:

Update: I see now that any new plot window will only ever display "R Plot

  • Device 0" when I open a new plot window or try plotting from R Interactive. On systems where I have RTVS working (different laptop), it always has a positive integer. Is there a way to make RTVS use a correct plotting device?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/RTVS/issues/4325#issuecomment-406915730, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtUVM4xOS9UKTtQ1nz8B4ikvORgJT87ks5uJSoUgaJpZM4U1a0D .

smortaz commented 6 years ago

Ah, I see Hugues has already replied. I’ll reping.

huguesv commented 6 years ago

You can use the standard dev.* functions to manipulate the graphics devices.

dev.new() will create a new plot window in the ide. dev.list() and dev.cur(num) can change the active. dev.off() to close a graphics device / window. This is what the UI plot windows use internally. A device number of 0 is bad news, as you've noticed. It means it wasn't able to translate the internal device id to the public device number.

You can experiment with those commands and compare with your working machine to see if there is a clue there.

Note that you can instantiate a regular RGui graphics device: windows()

Then any plot operation will draw in the external window.

You can also change the default to always use that instead of RTVS plot window (best done right after reset, or after you've closed all graphics devices with dev.off()). options(device='windows')

or to return to the RTVS plot window as the default for the session: options(device='ide')

I doubt it is size related issue at this point, but there's Window -> Reset Window Layout that you can try.

jichavez3 commented 6 years ago

Thanks for the info! I tried all available options, and here's what I've seen:

When I use dev.new() I get the same error I get when I attempt plotting in RTVS:

R session is stopped. Click "Reset" to start a new one.

Interactive Window is disconnected from R session. Click "Reset" to start a new session.

Any dev.* action other than dev.new will either display "null device 1". Pulling up the RGui graphics device works well, however I was hoping to use the RTVS plotting device to have everything in 1 window for the current session. Any other ideas? Would there be something strange specifically with my computer considering plotting works fine with RGui and RStudio? I did a soft reset on my laptop, but I can do the full factory reset if you think that would potentially help.

Any information would be greatly appreciated.

Thanks,

Jason

On Mon, Jul 23, 2018 at 4:09 PM Hugues Valois notifications@github.com wrote:

You can use the standard dev.* functions to manipulate the graphics devices.

dev.new() will create a new plot window in the ide. dev.list() and dev.cur(num) can change the active. dev.off() to close a graphics device / window. This is what the UI plot windows use internally. A device number of 0 is bad news, as you've noticed. It means it wasn't able to translate the internal device id to the public device number.

You can experiment with those commands and compare with your working machine to see if there is a clue there.

Note that you can instantiate a regular RGui graphics device: windows()

Then any plot operation will draw in the external window.

You can also change the default to always use that instead of RTVS plot window (best done right after reset, or after you've closed all graphics devices with dev.off()). options(device='windows')

or to return to the RTVS plot window as the default for the session: options(device='ide')

I doubt it is size related issue at this point, but there's Window -> Reset Window Layout that you can try.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/RTVS/issues/4325#issuecomment-407184822, or mute the thread https://github.com/notifications/unsubscribe-auth/AmrKUbdxG436U-IeJu3LdYorsBglSw33ks5uJi2IgaJpZM4U1a0D .