microsoft / RTVS

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

Visual Studio Crashes with ggmap #4243

Closed amlucius closed 6 years ago

amlucius commented 6 years ago

I'm producing some heat maps with ggmap. I generally have my plot window on a separate screen from VS and enlarged. VS will crash and re-start when running these maps if the plot device is not already opened. Specifically, it opens to 'Device 0' then stops responding. If I open the plot window/device before running the code for the map, all goes well. This happened in RTVS 1.2 and 1.3. ...

If you have any screenshots demonstrating the issue, please include them as well to help us diagnose it better.

Additional information:

OS Information Version: Microsoft Windows NT 10.0.15063.0

RTVS Information: Assembly: Microsoft.VisualStudio.R.Package, Version=1.3.31108.1213, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

Active R URI: Microsoft R Open (3.4.0.0): C:\Program Files\Microsoft\MRO-3.4.0.0\

MikhailArkhipov commented 6 years ago

Any chance you can attach logs or send them via Feedback | Send Frown?

amlucius commented 6 years ago

Sent via frown, referenced this post.

On Mon, Dec 11, 2017 at 11:49 AM, amlucius wrote:

Just sent via a frown, but here it is again just in case.

On Mon, Dec 11, 2017 at 11:06 AM, Mikhail Arkhipov < notifications@github.com> wrote:

Any chance you can attach logs or send them via Feedback | Send Frown?

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

MikhailArkhipov commented 6 years ago
<source>ExtensionCrashNotification</source>
Microsoft.R.Components.Plots.Implementation.ViewModel.RPlotHistoryEntryViewModel..ctor
Microsoft.R.Components.Plots.Implementation.ViewModel.RPlotHistoryViewModel.AddOrUpdate
Microsoft.R.Components.Plots.Implementation.ViewModel.RPlotHistoryViewModel.ActivePlotChanged
USER32.dll!AddClipboardFormatListener
AlexanderSher commented 6 years ago

Most likely plotImage is null. And it is actually null when plot.IsError == true:

        public async Task LoadPlotAsync(PlotMessage plot, CancellationToken cancellationToken) {
            await _mainThread.SwitchToAsync(cancellationToken);

            var device = FindDevice(plot.DeviceId);
            device.DeviceNum = plot.DeviceNum;

            if (plot.IsClearAll) {
                device.Clear();
            } else if (plot.IsPlot) {
                try {
                    var img = plot.ToBitmapImage();

                    // Remember the size of the last plot.
                    // We'll use that when exporting the plot to image/pdf.
                    device.PixelWidth = img.PixelWidth;
                    device.PixelHeight = img.PixelHeight;
                    device.Resolution = (int)Math.Round(img.DpiX);

                    device.AddOrUpdate(plot.PlotId, img);
                } catch (Exception e) when (!e.IsCriticalException()) {
                }
            } else if (plot.IsError) {
                device.AddOrUpdate(plot.PlotId, null);
            }
MikhailArkhipov commented 6 years ago

https://github.com/Microsoft/RTVS/commit/ca0b76341db3f3321ca99a0a6e5bc2d82852d867