[BUG] Deserializing Issue w/SelectionMark FR 3.1.0-beta.4
See original GitHub issueDescribe the bug In cases where the model expects to see a selectionMark (all custom models trained have one), an “Unknown SelectionMarkState value.” error is returned. This specific case was on a radio box selection, not a checkbox.
Expected behavior Return a null value if the selectionMark cannot be found due to poor image quality or handwritten form hides the mark
Actual behavior (include Exception or Stack Trace)
{
“ClassName”: “System.ArgumentOutOfRangeException”,
“Message”: “Unknown SelectionMarkState value.”,
“Data”: null,
“InnerException”: null,
“HelpURL”: null,
“StackTraceString”: " at Azure.AI.FormRecognizer.Models.SelectionMarkStateExtensions.ToSelectionMarkState(String value)\r\n at Azure.AI.FormRecognizer.Models.FieldValue_internal…ctor(FieldValueType type, String valueString, Nullable1 valueDate, Nullable
1 valueTime, String valuePhoneNumber, Nullable1 valueNumber, Nullable
1 valueInteger, IReadOnlyList1 valueArray, IReadOnlyDictionary
2 valueObject, Nullable1 valueSelectionMark, Nullable
1 valueGender, String valueCountry, String text, IReadOnlyList1 boundingBox, Nullable
1 confidence, IReadOnlyList1 elements, Nullable
1 page)\r\n at Azure.AI.FormRecognizer.Models.FieldValue_internal.DeserializeFieldValue_internal(JsonElement element)\r\n at Azure.AI.FormRecognizer.Models.DocumentResult.DeserializeDocumentResult(JsonElement element)\r\n at Azure.AI.FormRecognizer.Models.AnalyzeResult.DeserializeAnalyzeResult(JsonElement element)\r\n at Azure.AI.FormRecognizer.Models.AnalyzeOperationResult.DeserializeAnalyzeOperationResult(JsonElement element)\r\n at Azure.AI.FormRecognizer.FormRecognizerRestClient.GetAnalyzeFormResultAsync(Guid modelId, Guid resultId, CancellationToken cancellationToken)\r\n at Azure.AI.FormRecognizer.Models.RecognizeCustomFormsOperation.UpdateStatusAsync(Boolean async, CancellationToken cancellationToken)\r\n at Azure.AI.FormRecognizer.Models.RecognizeCustomFormsOperation.UpdateStatusAsync(CancellationToken cancellationToken)\r\n at Azure.Core.OperationHelpers.DefaultWaitForCompletionAsync[TResult](Operation`1 operation, TimeSpan pollingInterval, CancellationToken cancellationToken)\r\n at FormRecognizerFunctions.MedicalCertificate.Run(HttpRequest req, ILogger log) in C:\Users\T002845\source\repos\FormRecognizerFunctions\MedicalCertificate.cs:line 46",
“RemoteStackTraceString”: null,
“RemoteStackIndex”: 0,
“ExceptionMethod”: null,
“HResult”: -2146233086,
“Source”: “Azure.AI.FormRecognizer”,
“WatsonBuckets”: null,
“ParamName”: “value”,
“ActualValue”: “O”
}
To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
- Train a custom model that uses a radio button checkbox and have all trained models where the selection can be found
- Define custom model tag as a selectionMark
- Analyze an image using the model where the value cannot be found.
- In most cases it returns null as expected, however I have 2 documents that consistently toss the error. I am unable to provide those documents due to restrictions. I have tried recreating some mock documents that would cause the same error to occur but unfortunately haven’t been able to.
Environment:
- Azure.AI.FormRecognizer (3.1.0-beta.4)
- .NET SDK (reflecting any global.json): Version: 5.0.202 Commit: db7cc87d51
Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.202\
Host (useful for support): Version: 5.0.5 Commit: 2f740adc14
.NET SDKs installed: 5.0.202 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
- IDE and version : Microsoft Visual Studio Professional 2019 Version 16.9.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@RJWerning I am going to close the issue as you are unblocked. As for the past errors, looks like the service was returning new values that the SDK was not aware of and therefore the exception. This has been fixed in the new upcoming version.
Thanks!
Yes, I’m unblocked.
apim-request-id: 19b27a74-48a9-44fe-8c19-1a212dd929fa apim-request-id: ea581571-6331-436d-93b3-aa9d5ebe5681