the JsonSerializerSettings needs a MaxDepth = int.MaxValue, as in version 13 a small default max depth has been introduced.
This exact error is caused when applying the template in the AdaptiveCardTemplate constructor but will also happen again inside the AdaptiveCard.FromJson call if the maxdepth is not applied to both areas of the code.
AdaptiveCards.Templating.AdaptiveTemplateException
HResult=0x80131500
Message=Setting root data failed with given data context
Source=AdaptiveCards.Templating
StackTrace:
at AdaptiveCards.Templating.AdaptiveCardsTemplateVisitor..ctor(Func2 nullSubstitutionOption, String data) at AdaptiveCards.Templating.AdaptiveCardTemplate.Expand(EvaluationContext context, Func2 nullSubstitutionOption)
at AdaptiveCards.Templating.AdaptiveCardTemplate.Expand(Object rootData, Func`2 nullSubstitutionOption)
at BottKitt.Bot.Flow.FlowDialogConverter.<>c__DisplayClass56_0.<b__0>d.MoveNext() in
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
JsonReaderException: The reader's MaxDepth of 64 has been exceeded. Path '$tenjinInterpolatedVariables.conversation.DialogState.dialogStack[0].state.dialogs.dialogStack[0].state.dialogs.dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state', line 1, position 6345.
Target Platforms
Other
SDK Version
2.7.3
Application Name
Custom Application
Problem Description
Can you please support Newtonsoft version 13, when Newtonsoft version 12 is used this bug does not happen but version 12 has a security vulnerability.
https://security.snyk.io/vuln/SNYK-DOTNET-NEWTONSOFTJSON-2774678
the JsonSerializerSettings needs a MaxDepth = int.MaxValue, as in version 13 a small default max depth has been introduced.
This exact error is caused when applying the template in the AdaptiveCardTemplate constructor but will also happen again inside the AdaptiveCard.FromJson call if the maxdepth is not applied to both areas of the code.
AdaptiveCards.Templating.AdaptiveTemplateException HResult=0x80131500 Message=Setting root data failed with given data context Source=AdaptiveCards.Templating StackTrace: at AdaptiveCards.Templating.AdaptiveCardsTemplateVisitor..ctor(Funcb__0>d.MoveNext() in
2 nullSubstitutionOption, String data) at AdaptiveCards.Templating.AdaptiveCardTemplate.Expand(EvaluationContext context, Func
2 nullSubstitutionOption) at AdaptiveCards.Templating.AdaptiveCardTemplate.Expand(Object rootData, Func`2 nullSubstitutionOption) at BottKitt.Bot.Flow.FlowDialogConverter.<>c__DisplayClass56_0.<This exception was originally thrown at this call stack: [External Code]
Inner Exception 1: JsonReaderException: The reader's MaxDepth of 64 has been exceeded. Path '$tenjinInterpolatedVariables.conversation.DialogState.dialogStack[0].state.dialogs.dialogStack[0].state.dialogs.dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state.dialogs.dialogStack[0].state._adaptive.actions[0].dialogStack[0].state', line 1, position 6345.
Screenshots
No response
Card JSON
Sample Code Language
c#
Sample Code
AdaptiveCard.FromJson(new AdaptiveCardTemplate(templateJson).Expand(rootData)).Card;