microsoft/RTVS

Visual Studio Crashes with ggmap

amlucius opened this issue · 5 comments

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\

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

<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

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);
            }