protected override async Task InitializeCoreAsync(CancellationToken cancellationToken) { IProjectGuidService2 projectGuidService = ProjectGuidServices.FirstOrDefault()?.Value as IProjectGuidService2; if (projectGuidService == null) { return; } _projectGuid = await projectGuidService.GetProjectGuidAsync() .ConfigureAwait(false); Assumes.False(_projectGuid == Guid.Empty); _startupProjectsListService = (IVsStartupProjectsListService)await _serviceProvider.GetServiceAsync(typeof(SVsStartupProjectsListService)) .ConfigureAwait(false); Assumes.Present(_startupProjectsListService); _subscription = _projectSubscriptionService.ProjectRuleSource.SourceBlock.LinkTo( target: new ActionBlock <IProjectVersionedValue <IProjectSubscriptionUpdate> >(OnProjectChangedAsync), suppressVersionOnlyUpdates: true, linkOptions: new DataflowLinkOptions() { PropagateCompletion = true }); }
private StartupProjectRegistrar CreateInstance( UnconfiguredProject project = null, IAsyncServiceProvider serviceProvider = null, IVsStartupProjectsListService vsStartupProjectsListService = null, IProjectThreadingService threadingService = null, IProjectGuidService2 projectGuidService = null, IActiveConfiguredProjectSubscriptionService projectSubscriptionService = null, ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders = null) { if (serviceProvider == null) { var sp = new IAsyncServiceProviderMoq(); sp.AddService(typeof(SVsStartupProjectsListService), vsStartupProjectsListService ?? IVsStartupProjectsListServiceFactory.Create()); serviceProvider = sp; } var instance = new StartupProjectRegistrar( project ?? UnconfiguredProjectFactory.Create(), serviceProvider, threadingService ?? new IProjectThreadingServiceMock(), projectSubscriptionService ?? IActiveConfiguredProjectSubscriptionServiceFactory.Create(), launchProviders); if (projectGuidService != null) { instance.ProjectGuidServices.Add((IProjectGuidService)projectGuidService); } return(instance); }
public StartupProjectRegistrar( IProjectThreadingService threadingService, [Import(typeof(IProjectGuidService))] IProjectGuidService2 projectGuidService, IActiveConfiguredProjectSubscriptionService projectSubscriptionService, ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders) : this(AsyncServiceProvider.GlobalProvider, threadingService, projectGuidService, projectSubscriptionService, launchProviders) { }
public async Task <Guid> GetProjectGuidAsync() { await _tasksService.PrioritizedProjectLoadedInHost; #pragma warning disable RS0030 // IProjectGuidService is banned IProjectGuidService?projectGuidService = ProjectGuidServices.FirstOrDefault()?.Value; return(projectGuidService switch { null => Guid.Empty, IProjectGuidService2 projectGuidService2 => await projectGuidService2.GetProjectGuidAsync(), _ => projectGuidService.ProjectGuid });
private async Task <StartupProjectRegistrar> CreateInitializedInstanceAsync( IAsyncServiceProvider serviceProvider = null, IVsStartupProjectsListService vsStartupProjectsListService = null, IProjectThreadingService threadingService = null, IProjectGuidService2 projectGuidService = null, IActiveConfiguredProjectSubscriptionService projectSubscriptionService = null, ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders = null) { var instance = CreateInstance(serviceProvider, vsStartupProjectsListService, threadingService, projectGuidService, projectSubscriptionService, launchProviders); await instance.InitializeAsync(); return(instance); }
public StartupProjectRegistrar( IAsyncServiceProvider serviceProvider, IProjectThreadingService threadingService, IProjectGuidService2 projectGuidService, IActiveConfiguredProjectSubscriptionService projectSubscriptionService, ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders) : base(threadingService.JoinableTaskContext) { _serviceProvider = serviceProvider; _threadingService = threadingService; _projectGuidService = projectGuidService; _projectSubscriptionService = projectSubscriptionService; _launchProviders = launchProviders; }
public UnconfiguredProjectContextProvider(IUnconfiguredProjectCommonServices commonServices, Lazy <IWorkspaceProjectContextFactory> contextFactory, IProjectAsyncLoadDashboard asyncLoadDashboard, ITaskScheduler taskScheduler, IProjectHostProvider projectHostProvider, IActiveConfiguredProjectsProvider activeConfiguredProjectsProvider, [Import(typeof(IProjectGuidService))] IProjectGuidService2 projectGuidService) { _commonServices = commonServices; _contextFactory = contextFactory; _asyncLoadDashboard = asyncLoadDashboard; _taskScheduler = taskScheduler; _projectHostProvider = projectHostProvider; _activeConfiguredProjectsProvider = activeConfiguredProjectsProvider; _projectGuidService = projectGuidService; _unconfiguredProjectHostObject = _projectHostProvider.UnconfiguredProjectHostObject; }
private StartupProjectRegistrar CreateInstance( IAsyncServiceProvider serviceProvider = null, IVsStartupProjectsListService vsStartupProjectsListService = null, IProjectThreadingService threadingService = null, IProjectGuidService2 projectGuidService = null, IActiveConfiguredProjectSubscriptionService projectSubscriptionService = null, ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders = null) { if (serviceProvider == null) { var sp = new IAsyncServiceProviderMoq(); sp.AddService(typeof(SVsStartupProjectsListService), vsStartupProjectsListService ?? IVsStartupProjectsListServiceFactory.Create()); serviceProvider = sp; } return(new StartupProjectRegistrar( serviceProvider, threadingService ?? new IProjectThreadingServiceMock(), projectGuidService ?? IProjectGuidService2Factory.ImplementGetProjectGuidAsync(Guid.NewGuid()), projectSubscriptionService ?? IActiveConfiguredProjectSubscriptionServiceFactory.Create(), launchProviders)); }