public RProjectLoadHooks(UnconfiguredProject unconfiguredProject , [ImportMany("Microsoft.VisualStudio.ProjectSystem.Microsoft.VisualStudio.Shell.Interop.IVsProject")] IEnumerable <Lazy <IVsProject> > cpsIVsProjects , IProjectLockService projectLockService , IRInteractiveWorkflowProvider workflowProvider , IInteractiveWindowComponentContainerFactory componentContainerFactory , IRToolsSettings toolsSettings , IFileSystem fileSystem , IThreadHandling threadHandling, ISurveyNewsService surveyNews) { _unconfiguredProject = unconfiguredProject; _cpsIVsProjects = cpsIVsProjects; _workflowProvider = workflowProvider; _componentContainerFactory = componentContainerFactory; _toolsSettings = toolsSettings; _fileSystem = fileSystem; _threadHandling = threadHandling; _surveyNews = surveyNews; _projectDirectory = unconfiguredProject.GetProjectDirectory(); unconfiguredProject.ProjectUnloading += ProjectUnloading; _fileWatcher = new MsBuildFileSystemWatcher(_projectDirectory, "*", 25, 1000, fileSystem, new RMsBuildFileSystemFilter()); _fileWatcher.Error += FileWatcherError; Project = new FileSystemMirroringProject(unconfiguredProject, projectLockService, _fileWatcher); }
public WindowModel(UnconfiguredProject project, IEnumerable <IDeployTargetUI> targetUIs, IProjectLockService lockService, IThreadHandling threadHandling) { this.project = project; this.threadHandling = threadHandling; this.lockService = lockService; TargetUIs = targetUIs; }
/// <summary> /// Retrieve the CPS enabled JoinableTaskFactory for the current version of Visual Studio. /// This overrides the default VsTaskLibraryHelper.ServiceInstance JTF. /// </summary> public static void SetJoinableTaskFactoryFromService(IProjectServiceAccessor projectServiceAccessor) { if (projectServiceAccessor == null) { throw new ArgumentNullException(nameof(projectServiceAccessor)); } if (_joinableTaskFactory == null) { _joinableTaskFactory = new Lazy <JoinableTaskFactory>(() => { #if VS14 // Use IThreadHandling.AsyncPump for Visual Studio 2015 ProjectService projectService = projectServiceAccessor.GetProjectService(); IThreadHandling threadHandling = projectService.Services.ThreadingPolicy; return(threadHandling.AsyncPump); #else // Use IProjectService for Visual Studio 2017 var projectService = projectServiceAccessor.GetProjectService(); return(projectService.Services.ThreadingPolicy.JoinableTaskFactory); #endif }, // This option helps avoiding deadlocks caused by CPS trying to create ProjectServiceHost // PublicationOnly mode lets parallel threads execute value factory method without // being blocked on each other. // It is correct behavior in this case as the value factory provides the same value // each time it is called and Lazy is used just for caching the value for perf reasons. LazyThreadSafetyMode.PublicationOnly); } }
public GitHubDeploy(IUserSettings settings, UnconfiguredProject project, IProjectLockService projectLockService, IThreadHandling threadHandler) { this.project = project; this.projectLockService = projectLockService; this.threadHandler = threadHandler; this.settings = settings; }
public WindowModel(UnconfiguredProject project, IEnumerable<IDeployTargetUI> targetUIs, IProjectLockService lockService, IThreadHandling threadHandling) { this.project = project; this.threadHandling = threadHandling; this.lockService = lockService; TargetUIs = targetUIs; }
private CommandGroupHandler(UnconfiguredProject project, IThreadHandling threadHandler, IProjectLockService lockService, [ImportMany] IEnumerable <IDeployTargetUI> targetUIs, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { this.threadHandler = threadHandler; threadHandler.VerifyOnUIThread(); this.project = project; uiShell = (IVsUIShell)serviceProvider.GetService(typeof(IVsUIShell)); docTable = (IVsRunningDocumentTable)serviceProvider.GetService(typeof(IVsRunningDocumentTable)); ProjectHierarchies = new OrderPrecedenceImportCollection <IVsHierarchy>(projectCapabilityCheckProvider: project); this.lockService = lockService; this.targetUIs = targetUIs; }
private CommandGroupHandler(UnconfiguredProject project, IThreadHandling threadHandler, IProjectLockService lockService, [ImportMany] IEnumerable<IDeployTargetUI> targetUIs, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { this.threadHandler = threadHandler; threadHandler.VerifyOnUIThread(); this.project = project; uiShell = (IVsUIShell)serviceProvider.GetService(typeof(IVsUIShell)); docTable = (IVsRunningDocumentTable)serviceProvider.GetService(typeof(IVsRunningDocumentTable)); ProjectHierarchies = new OrderPrecedenceImportCollection<IVsHierarchy>(projectCapabilityCheckProvider: project); this.lockService = lockService; this.targetUIs = targetUIs; }
public RProjectLoadHooks(UnconfiguredProject unconfiguredProject, IProjectLockService projectLockService, IRInteractiveWorkflowProvider workflowProvider, IInteractiveWindowComponentContainerFactory componentContainerFactory, IRToolsSettings toolsSettings, IFileSystem fileSystem, IThreadHandling threadHandling) { _unconfiguredProject = unconfiguredProject; _workflowProvider = workflowProvider; _componentContainerFactory = componentContainerFactory; _toolsSettings = toolsSettings; _fileSystem = fileSystem; _threadHandling = threadHandling; _projectDirectory = unconfiguredProject.GetProjectDirectory(); unconfiguredProject.ProjectUnloading += ProjectUnloading; _fileWatcher = new MsBuildFileSystemWatcher(_projectDirectory, "*", 25, fileSystem, new RMsBuildFileSystemFilter()); Project = new FileSystemMirroringProject(unconfiguredProject, projectLockService, _fileWatcher); }
/// <summary> /// Sets NuGetPackageImportStamp to a new random guid. This is a hack to let the project system know it is out of date. /// The value does not matter, it just needs to change. /// </summary> protected static void UpdateImportStamp(EnvDTEProject envDTEProject, bool isCpsProjectSystem = false) { // There is no reason to call this for pre-Dev12 project systems. if (VSVersionHelper.VsMajorVersion >= 12) { #if VS14 // Switch to UI thread to update Import Stamp for Dev14. if (isCpsProjectSystem && VSVersionHelper.IsVisualStudio2014) { try { var projectServiceAccessor = ServiceLocator.GetInstance <IProjectServiceAccessor>(); ProjectService projectService = projectServiceAccessor.GetProjectService(); IThreadHandling threadHandling = projectService.Services.ThreadingPolicy; threadHandling.SwitchToUIThread(); } catch (Exception ex) { ExceptionHelper.WriteToActivityLog(ex); } } #endif IVsBuildPropertyStorage propStore = VsHierarchyUtility.ToVsHierarchy(envDTEProject) as IVsBuildPropertyStorage; if (propStore != null) { // <NuGetPackageImportStamp>af617720</NuGetPackageImportStamp> string stamp = Guid.NewGuid().ToString().Split('-')[0]; try { int r1 = propStore.SetPropertyValue(NuGetImportStamp, string.Empty, (uint)_PersistStorageType.PST_PROJECT_FILE, stamp); } catch (Exception ex1) { ExceptionHelper.WriteToActivityLog(ex1); } // Remove the NuGetImportStamp so that VC++ project file won't be updated with this stamp on disk, // which causes unnecessary source control pending changes. try { int r2 = propStore.RemoveProperty(NuGetImportStamp, string.Empty, (uint)_PersistStorageType.PST_PROJECT_FILE); } catch (Exception ex2) { ExceptionHelper.WriteToActivityLog(ex2); } } } }
/// <summary> /// Retrieve the CPS enabled JoinableTaskFactory for the current version of Visual Studio. /// This overrides the default VsTaskLibraryHelper.ServiceInstance JTF. /// </summary> public static void SetJoinableTaskFactoryFromService(IProjectServiceAccessor projectServiceAccessor) { if (projectServiceAccessor == null) { throw new ArgumentNullException(nameof(projectServiceAccessor)); } if (_joinableTaskFactory == null) { _joinableTaskFactory = new Lazy <JoinableTaskFactory>(() => { #if VS14 // Use IThreadHandling.AsyncPump for Visual Studio 2015 ProjectService projectService = projectServiceAccessor.GetProjectService(); IThreadHandling threadHandling = projectService.Services.ThreadingPolicy; return(threadHandling.AsyncPump); #else // Use IProjectService for Visual Studio 2017 IProjectService projectService = projectServiceAccessor.GetProjectService(); return(projectService.Services.ThreadingPolicy.JoinableTaskFactory); #endif }); } }
public VSThreadingService(IThreadHandling threadHandling) { _threadHandling = threadHandling; }
public PropertyProvider(IThreadHandling handling) : base(handling.JoinableTaskContext) { }