diff --git a/src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerDecompilerService.cs b/src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerDecompilerService.cs index f74d8c3122..a52b93854f 100644 --- a/src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerDecompilerService.cs +++ b/src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerDecompilerService.cs @@ -25,7 +25,10 @@ namespace ICSharpCode.ILSpyAddIn static DebuggerDecompilerService() { DebugInformation = new ConcurrentDictionary(); - ProjectService.SolutionClosed += delegate { DebugInformation.Clear(); }; + ProjectService.SolutionClosed += delegate { + DebugInformation.Clear(); + GC.Collect(); + }; } internal static IDebuggerDecompilerService Instance { get; private set; } diff --git a/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs b/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs index 4eb599314a..bc37972f18 100644 --- a/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs +++ b/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs @@ -95,9 +95,11 @@ namespace ICSharpCode.ILSpyAddIn codeView.Dispose(); BookmarkManager.Added -= BookmarkManager_Added; BookmarkManager.Removed -= BookmarkManager_Removed; - DecompileInformation data; - DebuggerDecompilerService.DebugInformation.TryRemove(decompiledType.MetadataToken.ToInt32(), out data); - data = null; + if (decompiledType != null) { + DecompileInformation data; + DebuggerDecompilerService.DebugInformation.TryRemove(decompiledType.MetadataToken.ToInt32(), out data); + data = null; + } base.Dispose(); } #endregion