You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
microsoft/botbuilder-dotnet#3711 introduced a cache for json converters, in which json converters are created once when converting first json, and reused in later json conversion.
The issue is, those json converters are stateful, in which SourceContext captured the state (the call stack). In order to make it work as expected, the call stacked must be initialized with a SourceRange pushed to bottom of the stack, and this initialization only happens when creating those converters.
So reusing the converters will not re-initializing the state, in this specific case, will not push a SourceRange into stack. Then all the following source range registering will not get a path value, and fail to load.
Fix
The fix in this PR is simply reverting the cache and reusing behavior of converters.
If for performance reason or any other reasons we want to reuse the converters, we need an approach to reset the converters with state. Could simplify be making a sub-class of JsonConverter and add a reset method, or other approach.
Description
Fixes microsoft/botbuilder-dotnet#3769 TestBot.Json broken in master
Context
microsoft/botbuilder-dotnet#3711 introduced a cache for json converters, in which json converters are created once when converting first json, and reused in later json conversion.
The issue is, those json converters are stateful, in which SourceContext captured the state (the call stack). In order to make it work as expected, the call stacked must be initialized with a SourceRange pushed to bottom of the stack, and this initialization only happens when creating those converters.
So reusing the converters will not re-initializing the state, in this specific case, will not push a SourceRange into stack. Then all the following source range registering will not get a path value, and fail to load.
Fix
The fix in this PR is simply reverting the cache and reusing behavior of converters.
If for performance reason or any other reasons we want to reuse the converters, we need an approach to reset the converters with state. Could simplify be making a sub-class of JsonConverter and add a reset method, or other approach.
Anyhow, leave the systematic to @tomlm or @willportnoy.
Changed projects
The text was updated successfully, but these errors were encountered: