private void UnregisterObjectBrowserLibraryManager() { if (_libraryManagerCookie != 0) { if (this.GetService(typeof(SVsObjectManager)) is IVsObjectManager2 objectManager) { objectManager.UnregisterLibrary(_libraryManagerCookie); _libraryManagerCookie = 0; } _libraryManager.Dispose(); _libraryManager = null; } }
private async Task UnregisterObjectBrowserLibraryManagerAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); if (_libraryManagerCookie != 0) { if (await GetServiceAsync(typeof(SVsObjectManager)).ConfigureAwait(true) is IVsObjectManager2 objectManager) { objectManager.UnregisterLibrary(_libraryManagerCookie); _libraryManagerCookie = 0; } _libraryManager.Dispose(); _libraryManager = null; } }