Backport #9430: [28.x] E-Document ADI import crashes with untrappable JSON error when ADI response lacks outputs.1 structure - #9901
Conversation
## Why The E-Document Matching Assistance (ADI) import path in `EDocument Json Helper` read properties from the ADI response using `JsonObject.Get(...)` without checking the boolean return value. When the Azure Document Intelligence response was malformed or missing an expected property (`outputs`, `1`, `result`, or `fields`), the subsequent `JsonToken.AsObject()` call operated on an uninitialized token, raising an untrappable runtime error that crashed the import instead of degrading gracefully. ## Summary - **Fixed** the untrappable JSON error by guarding every `Get` call in `GetInnerObject` and `GetHeaderFields`; when an expected property is absent the helper now returns an empty `JsonObject` instead of dereferencing an uninitialized token. - **Added** telemetry (`0000UK1`-`0000UK4`, Warning) under the "E-Document Matching Assistance" category so malformed ADI responses are diagnosable, with a locked label naming the missing property. [AB#640122](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/640122) --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Good Sense Reviewer - Round 1Recommendation: Request Changes This is a faithful code port of #9430 into 28.x, and it does prevent the missing-key crash. But it still leaves the malformed-shape case open, so the stated ADI crash fix is not complete. Suggestions
Risk & necessityThis backport is worth taking because the current 28.x code can crash on malformed ADI responses in a user-facing import path. If it ships as-is, some malformed responses will still crash instead of degrading gracefully, so the risk is reduced but not removed.
|
Backport of #9430 for AB#644118