From 192bfcd392dc7958ee29c9bbeb386ec5e6f9fa76 Mon Sep 17 00:00:00 2001 From: Ram Fattah <38049078+ramfattah@users.noreply.github.com> Date: Wed, 9 Aug 2023 21:04:59 -0700 Subject: [PATCH] Update InterfaceConverter.cs Resolve concurrency issues in InterfaceConverter's ReadJson method --- .../Converters/InterfaceConverter.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Converters/InterfaceConverter.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Converters/InterfaceConverter.cs index 02f625c781..d3feb9f8b8 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Converters/InterfaceConverter.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Converters/InterfaceConverter.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Collections.Concurrent; using System.Collections.Generic; using Microsoft.Bot.Builder.Dialogs.Debugging; using Microsoft.Bot.Builder.Dialogs.Declarative.Debugging; @@ -22,9 +23,9 @@ public class InterfaceConverter : JsonConverter, IObservableConverter, IObser private readonly ResourceExplorer resourceExplorer; private readonly List observers = new List(); private readonly SourceContext sourceContext; - private readonly Dictionary cachedRefDialogs = new Dictionary(); - private readonly Dictionary cachedTypes = new Dictionary(); - private readonly Dictionary rangeReferences = new Dictionary(JToken.EqualityComparer); + private readonly IDictionary cachedRefDialogs = new ConcurrentDictionary(); + private readonly IDictionary cachedTypes = new ConcurrentDictionary(); + private readonly IDictionary rangeReferences = new ConcurrentDictionary(JToken.EqualityComparer); /// /// Initializes a new instance of the class.