Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     exports.Dispose();
     // TODO: is this needed?
     GC.Collect();
     context.Dispose();
 }
Exemplo n.º 3
0
        public virtual async Task DisposeAsync()
        {
            await PackageIndex.DisposeAsync(ExportProvider);

            ExportProvider.Dispose();
        }