Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PORT] Revert the reusing of json converters #2085

Closed
tomlm opened this issue Apr 22, 2020 · 2 comments
Closed

[PORT] Revert the reusing of json converters #2085

tomlm opened this issue Apr 22, 2020 · 2 comments
Labels
R10 Release 10 - August 17th, 2020
Milestone

Comments

@tomlm
Copy link
Contributor

tomlm commented Apr 22, 2020

Port this change from botbuilder-dotnet/master branch:
microsoft/botbuilder-dotnet#3783

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

  • Microsoft.Bot.Builder.Dialogs.Declarative
  • Microsoft.Bot.Builder.TestBot.Json
@gabog gabog added Adaptive R10 Release 10 - August 17th, 2020 labels Jun 11, 2020
@gabog
Copy link
Contributor

gabog commented Jun 11, 2020

@boydc2014, does this apply to JS? Can you close it if it doesn't.

@chon219
Copy link
Member

chon219 commented Jun 23, 2020

We don't have this in JS, closing this issue.

@chon219 chon219 closed this as completed Jun 23, 2020
@munozemilio munozemilio added this to the R10 milestone Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R10 Release 10 - August 17th, 2020
Projects
None yet
Development

No branches or pull requests

4 participants