question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Deserializing Issue w/SelectionMark FR 3.1.0-beta.4

See original GitHub issue

Describe 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, Nullable1 valueTime, String valuePhoneNumber, Nullable1 valueNumber, Nullable1 valueInteger, IReadOnlyList1 valueArray, IReadOnlyDictionary2 valueObject, Nullable1 valueSelectionMark, Nullable1 valueGender, String valueCountry, String text, IReadOnlyList1 boundingBox, Nullable1 confidence, IReadOnlyList1 elements, Nullable1 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)

  1. Train a custom model that uses a radio button checkbox and have all trained models where the selection can be found
  2. Define custom model tag as a selectionMark
  3. Analyze an image using the model where the value cannot be found.
  4. 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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
maririoscommented, May 17, 2021

@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!

0reactions
RJWerningcommented, May 3, 2021

Yes, I’m unblocked.

apim-request-id: 19b27a74-48a9-44fe-8c19-1a212dd929fa apim-request-id: ea581571-6331-436d-93b3-aa9d5ebe5681

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found