Hi. I have STAThread winform application for scannig and barcode extraction.

During calling this code I get exception (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE))

var page = document.Pages[0];
   FREngine.IImageDocument imageDocument = page.ImageDocument;
   FREngine.IImage image = null;
   switch( imageDocument.ImageColorType ) {
        case FREngine.ImageColorTypeEnum.ICT_BlackWhite:
            image = imageDocument.BlackWhiteImage; break;
        case FREngine.ImageColorTypeEnum.ICT_Gray:
        case FREngine.ImageColorTypeEnum.ICT_Color:
               image = imageDocument.ColorImage; break;
  }
    FREngine.IHandle hBitmap = image.GetBitmap( null );

I tried to compile application in 64-bit mode and also force using 32-bit, but I got the same results.
Engine loader is also the same as in SDK samples.

Can help me to silve this?
How to get the image from memory?