C#System.ArgumentException:&x27;参数不正确。无效的子类型';在windows OCR中

C#System.ArgumentException:&x27;参数不正确。无效的子类型';在windows OCR中,c#,ocr,C#,Ocr,在Windows OCR软件中: 在OcrCapturedImage.xaml.cs中,我不明白为什么会出现以下情况: using (var currentFrame = await mediaCapture.GetPreviewFrameAsync(videoFrame)) 我得到了以下问题: 系统异常 System.ArgumentException:“参数不正确。 无效的子类型“ 以下是完整的方法: private async void ExtractButton_Tapped(obje

在Windows OCR软件中:

在OcrCapturedImage.xaml.cs中,我不明白为什么会出现以下情况:

using (var currentFrame = await mediaCapture.GetPreviewFrameAsync(videoFrame))
我得到了以下问题:

系统异常

System.ArgumentException:“参数不正确。

无效的子类型“

以下是完整的方法:

private async void ExtractButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
    {

        //Get information about the preview.
        var previewProperties = mediaCapture.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoPreview) as VideoEncodingProperties;
        int videoFrameWidth = (int)previewProperties.Width;
        int videoFrameHeight = (int)previewProperties.Height;

        // Create the video frame to request a SoftwareBitmap preview frame.
        var videoFrame = new VideoFrame(BitmapPixelFormat.Bgra8, videoFrameWidth, videoFrameHeight);

        // Capture the preview frame.
        using (var currentFrame = await mediaCapture.GetPreviewFrameAsync(videoFrame))
        {
            // Collect the resulting frame.
            SoftwareBitmap bitmap = currentFrame.SoftwareBitmap;

            OcrEngine ocrEngine = OcrEngine.TryCreateFromLanguage(ocrLanguage);

            if (ocrEngine == null)
            {
                rootPage.NotifyUser(ocrLanguage.DisplayName + " is not supported.", NotifyType.ErrorMessage);

                return;
            }

            var imgSource = new WriteableBitmap(bitmap.PixelWidth, bitmap.PixelHeight);
            bitmap.CopyToBuffer(imgSource.PixelBuffer);
            PreviewImage.Source = imgSource;

            var ocrResult = await ocrEngine.RecognizeAsync(bitmap);

        }
    }

感谢您的帮助

exception stacktrace!好的,不确定您的意思,使用ex.StackTrace,以下是我在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务任务)at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()在SDKTemplate.OcrCapturedImage.d_u17.MoveNext()上