diff --git a/src/dotnet/APIView/APIViewWeb/Helpers/CodeFileHelpers.cs b/src/dotnet/APIView/APIViewWeb/Helpers/CodeFileHelpers.cs index ce436d016b1..7a9ee3e5e18 100644 --- a/src/dotnet/APIView/APIViewWeb/Helpers/CodeFileHelpers.cs +++ b/src/dotnet/APIView/APIViewWeb/Helpers/CodeFileHelpers.cs @@ -738,12 +738,12 @@ private static void InsertCodePanelRowData(CodePanelData codePanelData, CodePane commentsForRow.AssociatedRowPositionInGroup = rowData.RowPositionInGroup; if (codePanelData.NodeMetaDataObj.ContainsKey(nodeIdHashed)) { - codePanelData.NodeMetaDataObj[nodeIdHashed].CommentThreadObj.Add(codePanelData.NodeMetaDataObj[nodeIdHashed].CodeLinesObj.Count() - 1, commentsForRow); //Map comment to the index of associated codeLine + codePanelData.NodeMetaDataObj[nodeIdHashed].CommentThreadObj.TryAdd(codePanelData.NodeMetaDataObj[nodeIdHashed].CodeLinesObj.Count() - 1, commentsForRow); //Map comment to the index of associated codeLine } else { codePanelData.NodeMetaDataObj.TryAdd(nodeIdHashed, new CodePanelNodeMetaData()); - codePanelData.NodeMetaDataObj[nodeIdHashed].CommentThreadObj.Add(codePanelData.NodeMetaDataObj[nodeIdHashed].CodeLinesObj.Count() - 1, commentsForRow); //Map comment to the index of associated codeLine + codePanelData.NodeMetaDataObj[nodeIdHashed].CommentThreadObj.TryAdd(codePanelData.NodeMetaDataObj[nodeIdHashed].CodeLinesObj.Count() - 1, commentsForRow); //Map comment to the index of associated codeLine } } } diff --git a/src/dotnet/APIView/APIViewWeb/LeanModels/ReviewRevisionPageModels.cs b/src/dotnet/APIView/APIViewWeb/LeanModels/ReviewRevisionPageModels.cs index b84cfcb8e49..9009ae37d98 100644 --- a/src/dotnet/APIView/APIViewWeb/LeanModels/ReviewRevisionPageModels.cs +++ b/src/dotnet/APIView/APIViewWeb/LeanModels/ReviewRevisionPageModels.cs @@ -111,8 +111,8 @@ public class CodePanelNodeMetaData public List CodeLinesObj { get; set; } = new List(); public List CodeLines => CodeLinesObj.Count > 0 ? CodeLinesObj : null; [JsonIgnore] - public Dictionary CommentThreadObj { get; set; } = new Dictionary(); //Dictionary key map to the index of the code line within this node which the comment thread is mapped to - public Dictionary CommentThread => CommentThreadObj.Count > 0 ? CommentThreadObj : null; + public ConcurrentDictionary CommentThreadObj { get; set; } = new ConcurrentDictionary(); //Dictionary key map to the index of the code line within this node which the comment thread is mapped to + public ConcurrentDictionary CommentThread => CommentThreadObj.Count > 0 ? CommentThreadObj : null; public NavigationTreeNode NavigationTreeNode { get; set; } public string ParentNodeIdHashed { get; set; } [JsonIgnore]