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.

[Form Recognizer] The given key 'Contact' was not present in the dictionary.

See original GitHub issue

We are running live Tests against other clouds like US Gov and Azure China Cloud. The goal is to check whether new azure sdk package work with other clouds or not.

Error Description:

Task StartRecognizeCustomFormsWithLabelsCanParseMultipageForm failed in pipeline weekly-test on UsGov. The error message as follow:

  Error Message:
   System.Collections.Generic.KeyNotFoundException : The given key 'Contact' was not present in the dictionary.
  Stack Trace:
     at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Azure.AI.FormRecognizer.Tests.RecognizeCustomFormsLiveTests.StartRecognizeCustomFormsWithLabelsCanParseMultipageForm(Boolean useStream) in /mnt/vss/_work/1/s/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/RecognizeCustomFormsLiveTests.cs:line 210
   at Azure.AI.FormRecognizer.Tests.RecognizeCustomFormsLiveTests.StartRecognizeCustomFormsWithLabelsCanParseMultipageForm(Boolean useStream) in /mnt/vss/_work/1/s/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/RecognizeCustomFormsLiveTests.cs:line 217
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
  Standard Output Messages:
 [09:46:35.132] Request daecd95c-2c54-4c05-aea8-7b956e98083e
   method: POST
   uri: ***/formrecognizer/v2.0/custom/models
   headers: 
     Accept:application/json
     x-ms-client-request-id:daecd95c-2c54-4c05-aea8-7b956e98083e
     x-ms-return-client-request-id:true
     User-Agent:azsdk-net-AI.FormRecognizer/3.2.0-alpha.20210727.1,(.NET Core 3.1.17; Linux 5.8.0-1039-azure #42~20.04.1-Ubuntu SMP Thu Jul 15 14:11:07 UTC 2021)
     Ocp-Apim-Subscription-Key:REDACTED
     Content-Type:application/json
   clientAssembly: Azure.AI.FormRecognizer

Error Track:

Detail: Code Link image

The exception above throws by assert code : Assert.AreEqual("Jamie@southridgevideo.com", recognizedForm.Fields["Contact"].Value.AsString()); .

Expected Behavior

The investigate so far, in local test: recognizedForm.Fields does not contains parameter Contact, but contains some parameters that not exist in TestFile.InvoiceMultipage file, it’s really strange. Environment variables I gived in local test:

  • Endpoint
  • ApiKey
  • MultipageBlobContainerSasUrl

Am I missing something or need to set other variables?

@jongio, @benbp, @maririos for notification.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
zedy-wjcommented, Sep 1, 2021

@maririos - Completed the updates in container, thanks for your help 😃

0reactions
v-xutocommented, Sep 1, 2021

This issue has been fixed, so we close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# Plugin error "The given key was not present in the dictionary"
Hello, I am facing a familiar error "The given key was not present in the dictionary" while developing a C# plugin, in a...
Read more >
The Given Key Was Not Present in the Dictionary: Here's Why
The given key was not present in the dictionary error occurs when you try to index something that does not exist. This guide...
Read more >
Dynamics CRM 365 Error 'The Given Key Is Not Present In ...
As a Dynamics CRM developer, we always come across the error saying that 'The Given Key is not present in dictionary'.
Read more >
"The given key was not present in the dictionary" error ...
Solution. It is necessary to remove the "maindb. xml" file in the following way:
Read more >
CrmException: The given key was not present in ...
As the title says we're now getting a "CrmException: The given key was not present in the dictionary." error when trying to open...
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