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] Model Id Type in the SDK does not match Studio

See original GitHub issue

Library name and version

Azure.AI.FormRecognizer 3.1.1

Describe the bug

Hi,

In Form Recognizer .NET SDK the method StartRecognizeCustomFormsAsync expects a Guid as the model id for Custom Models. When creating custom models in the Form Recognizer Studio it there is no such restriction on the model id and these can be named as any string of text, for example “completed_model_2”.

image

When passing this to the SDK:

image image

The following error is thrown

FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

It’s possible to use the REST API directly and pass in these model ids, however it would be preferable to consume the SDK rather than re-implementing the functionality built by Microsoft and this is a blocker for adoption for us also I’m sure will be a source of confusion for other customers.

I’m seeing the same behaviour in both the current stable 3.1.1 and the latest preview 4.0.0-beta.3 of the .NET SDK.

Expected behavior

A string modelid that is not restricted to a Guid is accepted

Actual behavior

An ArgumentException is thrown

Reproduction Steps

RecognizeCustomFormsOptions recognizeContentOptions = new RecognizeCustomFormsOptions { ContentType = FormContentType.Png};
AzureKeyCredential credential = new AzureKeyCredential("YOUR KEY");
FormRecognizerClient client = new FormRecognizerClient(new Uri("YOUR ENDPOINT"), credential);
Azure.Response<RecognizedFormCollection> formPages = await client
                    .StartRecognizeCustomFormsAsync("completed-model-2", document.Content, recognizeContentOptions).WaitForCompletionAsync().ConfigureAwait(false);

Environment

Windows 10 .NET 6

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Pepsi1x1commented, May 18, 2022

Thanks @maririos that is indeed what I needed and the linked documentation is clear.

0reactions
kinelskicommented, Aug 2, 2022

Error is still present System.ArgumentException: ‘The modelId must be a valid GUID. Arg_ParamName_Name’

Form Recognizer Studio generated code (C#) does not work

Validation still check fora a valid GUID see code Line 23 https://github.com/Azure/azure-sdk-for-net/blob/Azure.AI.FormRecognizer_4.0.0-beta.4/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ClientCommon.cs

@pluservice The validation code you linked is only called if you’re using the old FormRecognizerClient, which targets old service versions that only support GUID model IDs. In order to use the newest service version, the DocumentAnalysisClient must be used. Please check our documentation here for more information.

If you still think there’s a bug in the SDK, please feel free to open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issuer validation failed. Issuer did not match. #10529
Describe the bug When trying retrieve blob data from the azure storage I get an error Expected behavior Being authenticated and retrieving ...
Read more >
How to fix 'Unable to determine application id: com.android ...
Your Gradle is out of sync. Go to: File -> Sync Project with Gradle Files . It should fix the problem. enter image...
Read more >
[BUG] BlobClient.DownloadAsync() Response x-ms-client- ...
Using the latest Blazor WebAssembly sdk I am trying to download a ... DownloadAsync() Response x-ms-client-request-id does not match the ...
Read more >
Failed to find Build Tools revision 30.0.1
I think every Gradle+plugin version is mapped to a given Buildtoolversion and for my one it is 30.0.1 but sadly SDK tool version...
Read more >
Failed to update Android SDK package list error when ...
Here I unticked the following boxes under ANDROID: (a) JDK installed with Unity (Recommended) and browsed to where Java is stored (C:\Program ...
Read more >

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