private void OnCacheFlushRequested(object sender, EventArgs e) { if (_backgroundCompiler != null) { _backgroundCompiler.Dispose(); _backgroundCompiler = null; // PartialSemanticsEnabled will now return false } // No longer need cache notifications var cacheService = Services.GetService <IWorkspaceCacheService>(); if (cacheService != null) { cacheService.CacheFlushRequested -= OnCacheFlushRequested; } }