public async Task InitializeAsync() { await _threadHandling.Value.SwitchToUIThread(); // Initialize our cache file string appDataFolder = await _shellUtilitiesHelper.Value.GetLocalAppDataFolderAsync(_serviceProvider).ConfigureAwait(true); if (appDataFolder != null) { _versionDataCacheFile = new RemoteCacheFile(Path.Combine(appDataFolder, VersionDataFilename), VersionCompatibilityDownloadFwlink, TimeSpan.FromHours(CacheFileValidHours), _fileSystem.Value, _httpClient); } _ourVSVersion = await _shellUtilitiesHelper.Value.GetVSVersionAsync(_serviceProvider).ConfigureAwait(true); IVsSolution solution = _serviceProvider.GetService <IVsSolution, SVsSolution>(); Verify.HResult(solution.AdviseSolutionEvents(this, out _solutionCookie)); // Check to see if a solution is already open. If so we set _solutionOpened to true so that subsequent projects added to // this solution are processed. if (ErrorHandler.Succeeded(solution.GetProperty((int)__VSPROPID4.VSPROPID_IsSolutionFullyLoaded, out object isFullyLoaded)) && isFullyLoaded is bool && (bool)isFullyLoaded) { _solutionOpened = true; } }
public async Task InitializeAsync() { await _threadHandling.Value.SwitchToUIThread(); // Initialize our cache file string appDataFolder = await _shellUtilitiesHelper.Value.GetLocalAppDataFolderAsync(_vsShellService); if (appDataFolder != null) { _versionDataCacheFile = new RemoteCacheFile(Path.Combine(appDataFolder, VersionDataFilename), VersionCompatibilityDownloadFwlink, TimeSpan.FromHours(CacheFileValidHours), _fileSystem.Value, _httpClient); } _ourVSVersion = await _shellUtilitiesHelper.Value.GetVSVersionAsync(_vsAppIdService); _vsSolution = await _vsSolutionService.GetValueAsync(); Verify.HResult(_vsSolution.AdviseSolutionEvents(this, out _solutionCookie)); // Check to see if a solution is already open. If so we set _solutionOpened to true so that subsequent projects added to // this solution are processed. if (ErrorHandler.Succeeded(_vsSolution.GetProperty((int)__VSPROPID4.VSPROPID_IsSolutionFullyLoaded, out object isFullyLoaded)) && isFullyLoaded is bool isFullyLoadedBool && isFullyLoadedBool) { _solutionOpened = true; // do not block package initialization on this _threadHandling.Value.RunAndForget(() => CheckCompatibilityAsync(), unconfiguredProject: null); } }