public SolutionRestoreWorker( IAsyncServiceProvider asyncServiceProvider, Lazy <IVsSolutionManager> solutionManager, Lazy <INuGetLockService> lockService, Lazy <Common.ILogger> logger, Lazy <INuGetErrorList> errorList, Lazy <IOutputConsoleProvider> outputConsoleProvider) { if (asyncServiceProvider == null) { throw new ArgumentNullException(nameof(asyncServiceProvider)); } if (solutionManager == null) { throw new ArgumentNullException(nameof(solutionManager)); } if (lockService == null) { throw new ArgumentNullException(nameof(lockService)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (errorList == null) { throw new ArgumentNullException(nameof(errorList)); } if (outputConsoleProvider == null) { throw new ArgumentNullException(nameof(outputConsoleProvider)); } _asyncServiceProvider = asyncServiceProvider; _solutionManager = solutionManager; _lockService = lockService; _logger = logger; _errorList = errorList; _outputConsoleProvider = outputConsoleProvider; var joinableTaskContextNode = new JoinableTaskContextNode(ThreadHelper.JoinableTaskContext); _joinableCollection = joinableTaskContextNode.CreateCollection(); JoinableTaskFactory = joinableTaskContextNode.CreateFactory(_joinableCollection); _componentModel = new AsyncLazy <IComponentModel>(async() => { return(await asyncServiceProvider.GetServiceAsync <SComponentModel, IComponentModel>()); }, JoinableTaskFactory); _solutionLoadedEvent = new AsyncManualResetEvent(); _isCompleteEvent = new AsyncManualResetEvent(); Reset(); }
public SolutionRestoreWorker( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, Lazy <IVsSolutionManager> solutionManager, Lazy <INuGetLockService> lockService, [Import("VisualStudioActivityLogger")] Lazy <Common.ILogger> logger, Lazy <ErrorListTableDataSource> errorListTableDataSource) { if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (solutionManager == null) { throw new ArgumentNullException(nameof(solutionManager)); } if (lockService == null) { throw new ArgumentNullException(nameof(lockService)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (errorListTableDataSource == null) { throw new ArgumentNullException(nameof(errorListTableDataSource)); } _serviceProvider = serviceProvider; _solutionManager = solutionManager; _lockService = lockService; _logger = logger; _errorListTableDataSource = errorListTableDataSource; var joinableTaskContextNode = new JoinableTaskContextNode(ThreadHelper.JoinableTaskContext); _joinableCollection = joinableTaskContextNode.CreateCollection(); _joinableFactory = joinableTaskContextNode.CreateFactory(_joinableCollection); _componentModel = new AsyncLazy <IComponentModel>(async() => { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); return(serviceProvider.GetService <SComponentModel, IComponentModel>()); }, _joinableFactory); _solutionLoadedEvent = new AsyncManualResetEvent(); _isCompleteEvent = new AsyncManualResetEvent(); Reset(); }