_imageViewerControl.GetCurrentDisplayedImageAsBitmap() crashes

Hi,

We are using imageviewer control and when we click print initially even after handling exception by putting try/catch block still we receive exception

SDK - MIP 2020 R1

Xprotect - Corporate 2020 R1

code snippet on print()

public override void Print()

{    

  try

  {        

    if (\_imageViewerControl != null && \_imageViewerControl.CameraFQID != null)

    {

      System.Drawing.Bitmap bitmap = null;

      bitmap = \_imageViewerControl.GetCurrentDisplayedImageAsBitmap();           

      if (bitmap != null)

      {

        ClientControl.Instance.Print(bitmap, [this.Name](http://this.Name "http://this.Name"), "", \_viewItemManager.CamName);

        bitmap.Dispose();

      }

      else

        MessageBox.Show("Failed. Offline.");

    }

  }

  catch(Exception)

  {

  }

}

error windows

stack trace

************** Outer Exception **************

Exception type:System.Runtime.InteropServices.SEHException

Exception message:External component has thrown an exception.

Exception source:VideoOS.Toolkit

Exception Target Site: GetCurrentImage

at VideoOS.Toolkit.RendererToolkit.GetCurrentImage(Int32 sourceId)

at VideoOS.UI.Common.WPF.VideoPlayer.Toolkit.ToolkitWrapper.GetCurrentImage(Guid sourceId)

at VideoOS.UI.Common.WPF.VideoPlayer.Toolkit.ToolkitVideoSource.GetCurrentImage()

at VideoOS.UI.Common.WPF.VideoPlayer.VideoPlayer.VideoGetCurrentImage(Boolean digitalZoomAreaOnly, Boolean includeImageOverlays)

at VideoOS.RemoteClient.Application.Data.ImageViewer.Wpf.ImageViewerControl.GetCurrentDisplayedImageAsBitmap(Boolean digitalZoomAreaOnly)

at VideoOS.RemoteClient.Application.MIP.PlatformImageViewerControl.GetCurrentDisplayedImageAsBitmap(Boolean digitalZoomOnly)

************** System Info **************

Date and time: 5/5/2020 9:21:16 AM

Processors count: 16

OS version: Microsoft Windows NT 6.2.9200.0

64 bit OS: True

64 bit process: True

Please help to solve

For further investigation, can you please narrow down your question a little bit more?

Is the connection fine?

What codec and resolution is the camera?

How to reproduce this?

Are you using it in live or playback?

We actually tested with VideoPreview sample and it works fine.

So, can you please explain what is different between that sample and your code?