Fix untrappable JSON error in E-Document ADI import (Bug 640122)#9430
Open
ventselartur wants to merge 3 commits into
Open
Fix untrappable JSON error in E-Document ADI import (Bug 640122)#9430ventselartur wants to merge 3 commits into
ventselartur wants to merge 3 commits into
Conversation
GetInnerObject and GetHeaderFields in codeunit 6121 "EDocument Json Helper" discarded the Boolean result of JsonObject.Get, so the AL runtime used the throwing overload and raised an untrappable NavNCLJsonPropertyNotFoundException when an ADI AnalyzeInvoice response was non-empty but lacked the expected outputs."1".result / fields shape. Guard every lookup and return an empty JsonObject on any missing key, mirroring GetLinesArray. A malformed ADI response now yields a blank draft instead of a crash; downstream setters already no-op on empty objects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 027b8c29-fadf-49a3-8e96-432cddb5e394
Log a Warning-verbosity telemetry event whenever GetInnerObject or GetHeaderFields encounters a missing key in the ADI response and returns an empty object. Uses a blank event tag to be filled by Expand-TelemetryTags. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 027b8c29-fadf-49a3-8e96-432cddb5e394
Contributor
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
Contributor
Copilot PR ReviewIteration 1 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@be1b92b624679f8c031061602e7d3a3b5f71a688 Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 15 knowledge-backed · 1 agent findings. Orchestrator pre-filter (16 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
Jose-agg
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The E-Document Matching Assistance (ADI) import path in
EDocument Json Helperread properties from the ADI response usingJsonObject.Get(...)without checking the boolean return value. When the Azure Document Intelligence response was malformed or missing an expected property (outputs,1,result, orfields), the subsequentJsonToken.AsObject()call operated on an uninitialized token, raising an untrappable runtime error that crashed the import instead of degrading gracefully.Summary
Getcall inGetInnerObjectandGetHeaderFields; when an expected property is absent the helper now returns an emptyJsonObjectinstead of dereferencing an uninitialized token.0000UK1-0000UK4, Warning) under the "E-Document Matching Assistance" category so malformed ADI responses are diagnosable, with a locked label naming the missing property.