public void Dispose() { // Dispose of packages while the UI thread is still running, it's // possible some packages may need to get back onto the UI thread // before their Dispose is complete. TaskProvider does this - it wants // to wait for the task provider thread to exit, but the same thread // maybe attempting to get back onto the UI thread. If we yank out // the UI thread first then it never makes it over and we just stop // responding and deadlock. foreach (var package in _loadedPackages) { package.Dispose(); } _monSel.UnadviseSelectionEvents(_monSelCookie); Shell.SetProperty((int)__VSSPROPID6.VSSPROPID_ShutdownStarted, true); _serviceProvider.Dispose(); _container.Dispose(); _shutdown = true; _uiEvent.Set(); if (!UIThread.Join(TimeSpan.FromSeconds(30))) { Console.WriteLine("Failed to wait for UI thread to terminate"); } ThrowPendingException(); AssertListener.ThrowUnhandled(); }
public void Dispose() { exports.Dispose(); // TODO: is this needed? GC.Collect(); context.Dispose(); }
public virtual async Task DisposeAsync() { await PackageIndex.DisposeAsync(ExportProvider); ExportProvider.Dispose(); }