diff --git a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs index 497ae61428a134e6a08c1ef86c0e0b9a29e7aca4..9f819345e6a4e42f968e4fe84ba33e69aa7be831 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using Roslyn.Utilities; @@ -259,8 +258,8 @@ public void OnRemoved() private sealed class AnalyzerTypeData { private const string UserDiagnosticsPrefixTableName = ""; - private static readonly ConditionalWeakTable s_analyzerTypeData - = new ConditionalWeakTable(); + private static readonly ConcurrentDictionary s_analyzerTypeData + = new ConcurrentDictionary(); private AnalyzerTypeData(Type type) { @@ -282,7 +281,7 @@ private AnalyzerTypeData(Type type) public static AnalyzerTypeData ForType(Type type) { - return s_analyzerTypeData.GetValue(type, t => new AnalyzerTypeData(t)); + return s_analyzerTypeData.GetOrAdd(type, t => new AnalyzerTypeData(t)); } } }