Skip to content

Form Recognizer SDK: Non-english Invoice date causing unhandled exception #20223

@kristapratico

Description

@kristapratico

Moving this issue to github from here


Hi Team,

We are using the Form Recognizer SDK version 3.1.0-beta.3 and encountered an exception with the following details:

Event time 4/1/2021, 4:47:48 PM (Local time)
Message Field value is null.
Exception type System.InvalidOperationException
Failed method Azure.AI.FormRecognizer.Models.FieldValue.AsDate
CorrelationId dc21fc3c-177d-49df-9663-443565810ba6

This issue occurred at the following code block:
if (invoice.Fields.TryGetValue("InvoiceDate", out FormField invoiceDateField))
{
if (invoiceDateField.Value.ValueType == FieldValueType.Date)
{
entities.InvoiceDate = invoiceDateField.Value.AsDate();

}
}

The value of the invoice date text was correctly picked as “21 de jul. de 2020” for this specific invoice however believe this failed as it could not be parsed to Date causing the Value.AsDate() to break. Would help to have such exceptions handled by the Form Recognizer SDK and perhaps return a Null value if the date parsing fails?

Metadata

Metadata

Labels

ClientThis issue is related to a non-management packageCognitive - Form Recognizerneeds-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions