azure-sdk-for-net
azure-sdk-for-net copied to clipboard
[BUG] The requested operation requires an element of type 'Number', but the target element has type 'String'.
Library name and version
Azure.AI.FormRecognizer Version 3.1.1
Describe the bug
Calling UpdateStatysAsync crashes on json deserialization
In general this works - for a certain document we tried it crashes.
Expected behavior
Should not crash deserializing the result from Azure Api.
Actual behavior
The following exception is thrown.
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: WaitOnOcrCompletion
---> System.InvalidOperationException: The requested operation requires an element of type 'Number', but the target element has type 'String'.
at System.Text.Json.JsonDocument.TryGetValue(Int32 index, Single& value)
at System.Text.Json.JsonElement.GetSingle()
at 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.FormRecognizer.Models.AnalyzeOperationResult.DeserializeAnalyzeOperationResult(JsonElement element)
at Azure.AI.FormRecognizer.FormRecognizerRestClient.GetAnalyzeFormResultAsync(Guid modelId, Guid resultId, CancellationToken cancellationToken)
at Azure.AI.FormRecognizer.Models.RecognizeCustomFormsOperation.UpdateStatusAsync(Boolean async, CancellationToken cancellationToken)
at Azure.AI.FormRecognizer.Models.RecognizeCustomFormsOperation.UpdateStatusAsync(CancellationToken cancellationToken)
Reproduction Steps
string operationId = 22976b9b-45cc-4479-b567-b46eb06e68e4/analyzeresults/fc97d418-1bb2-413d-9029-7886398cf5af var newOp = new RecognizeCustomFormsOperation(operationId, _formRecognizer); await newOp.UpdateStatusAsync();
This only crashes on this one result from Azure. (started today).
Environment
Azure function 4, dotnet 6
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hello @waynebrantley,
It seems the operation produced a result that can't be parsed by our SDK, which seems to be a bug. Does the error still happens if you try to start a new operation with the same file?
We cannot reproduce with the same document. I can tell you the document was blank though. So perhaps the result back from the OCR service is very different if it finds nothing?
@waynebrantley are you still blocked on the issue?
This has not happened with the latest SDK.
Hi @waynebrantley. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve
” to remove the “issue-addressed” label and continue the conversation.
Marking issue as addressed since neither customer nor us could reproduce it with the latest SDK.
Hi @waynebrantley, since you haven’t asked that we “/unresolve
” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve
” to reopen the issue.