.NET 的 Azure 认知服务表单识别器客户端库中的反序列化问题 - 版本 3.1.0-beta.4

问题描述

我有一个带有“标签表”的标签模型。此模型适用于最新的 REST API,但不适用于 .NET Client Library 3.1.0-beta.4。 如果模型预测“标签表”中的单元格为空,则库反序列化结果时会发生 InvalidOperationException。

Exception Details

system.invalidOperationException:请求的操作需要类型为“Object”的元素,但目标元素的类型为“Null”。在 System.Text.Json.JsonElement.EnumerateObject() 在 Azure.AI.FormRecognizer.Models.FieldValue_internal.DeserializefieldValue_internal(JsonElement 元素) 在 Azure.AI.FormRecognizer.Models.FieldValue_internal.DeserializefieldValue_internal(JsonElement 元素) 在 Azure.AI.FormRecognizer .Models.FieldValue_internal.DeserializefieldValue_internal(JsonElement element) at Azure.AI.FormRecognizer.Models.DocumentResult.DeserializeDocumentResult(JsonElement element) at Azure.AI.FormRecognizer.Models.AnalyzeResult.DeserializeAnalyzeResult(JsonElement element) at Azure.AI.ModelFormsRecognizer .AnalyzeOperationResult.DeserializeAnalyzeOperationResult(JsonElement element) at Azure.AI.FormRecognizer.FormRecognizerRestClient.GetAnalyzeformResultAsync(Guid modelId,Guid resultId,CancellationToken cancelationToken) at Azure.AI.FormRecognizer.Models.RecognizeCustomFormsOperation),Boolean. AI.FormRecognize r.Models.RecognizeCustomFormsOperation.UpdateStatusAsync(CancellationToken cancellingToken) at Azure.Core.OperationHelpers.DefaultWaitForCompletionAsync[TResult](Operation1 operation,TimeSpan pollingInterval,CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at KKELBelegAnalyzer.BelegAnalyzer.AnalyzeBeleg(Stream streamInput)

解决方法

对于那些有同样问题的人,这将在 5 月的下一个测试版中修复。
有关详细信息,请参阅提交的 GitHub issue OP。