Fix SetAnswerForQnAEvaluation: initialize Test Output Json before Add#7123
Open
DmitryKatson wants to merge 1 commit intomicrosoft:mainfrom
Open
Conversation
`SetAnswerForQnAEvaluation` was calling `CurrentTestOutputJson.Add(...)` without first calling `Initialize()`, causing the runtime error: "The data output is not initialized or is of the wrong type. It must be an Json object or array." Added the missing `CurrentTestOutputJson.Initialize()` call as the first statement in the procedure body, consistent with `SetQueryResponse`, `AddMessage`, and `SetTestOutput` in the same codeunit, all of which already call `Initialize()` before using `Test Output Json`.
|
Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link. |
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.
Summary
SetAnswerForQnAEvaluationinAITTestContextImpl.Codeunit.alcalledCurrentTestOutputJson.Add(...)without first callingInitialize(), causing the runtime error:Root cause
Codeunit "Test Output Json"requiresInitialize()before anyAddcall. All other procedures in the same codeunit (SetQueryResponse,AddMessage,SetTestOutput) already callInitialize()correctly —SetAnswerForQnAEvaluationwas the only one missing it.Fix
Added
CurrentTestOutputJson.Initialize();as the first statement inSetAnswerForQnAEvaluation, before the firstAddcall, insrc/Tools/AI Test Toolkit/src/AITTestContextImpl.Codeunit.al.