Esempio n. 1
0
 public void Dispose()
 {
     // Important for ProjectNodeComServices to null out fields to reduce the amount
     // of data we leak when extensions incorrectly holds onto the IVsHierarchy.
     _threadingService  = null;
     _configuredProject = null;
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public BuildMacroInfo(
     ActiveConfiguredProject <ConfiguredProject> configuredProject,
     IProjectThreadingService threadingService)
 {
     _threadingService  = threadingService;
     _configuredProject = configuredProject;
 }
        public UnconfiguredProjectCommonServices(
            [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService,
            IProjectThreadingService threadingService,
            UnconfiguredProject unconfiguredProject,
            IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscription,
            ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject,
            ActiveConfiguredProject <IAssemblyReferencesService> activeConfiguredProjectAssemblyReferences,
            ActiveConfiguredProject <IPackageReferencesService> activeConfiguredProjectPackageReferences,
            ActiveConfiguredProject <Rules.RazorProjectProperties> activeConfiguredProjectRazorProperties)
        {
            if (tasksService == null)
            {
                throw new ArgumentNullException(nameof(tasksService));
            }

            if (threadingService == null)
            {
                throw new ArgumentNullException(nameof(threadingService));
            }

            if (unconfiguredProject == null)
            {
                throw new ArgumentNullException(nameof(unconfiguredProject));
            }

            if (activeConfiguredProjectSubscription == null)
            {
                throw new ArgumentNullException(nameof(activeConfiguredProjectSubscription));
            }

            if (activeConfiguredProject == null)
            {
                throw new ArgumentNullException(nameof(activeConfiguredProject));
            }

            if (activeConfiguredProjectAssemblyReferences == null)
            {
                throw new ArgumentNullException(nameof(activeConfiguredProjectAssemblyReferences));
            }

            if (activeConfiguredProjectPackageReferences == null)
            {
                throw new ArgumentNullException(nameof(activeConfiguredProjectPackageReferences));
            }

            if (activeConfiguredProjectRazorProperties == null)
            {
                throw new ArgumentNullException(nameof(activeConfiguredProjectRazorProperties));
            }

            TasksService        = tasksService;
            ThreadingService    = threadingService;
            UnconfiguredProject = unconfiguredProject;
            ActiveConfiguredProjectSubscription        = activeConfiguredProjectSubscription;
            _activeConfiguredProject                   = activeConfiguredProject;
            _activeConfiguredProjectAssemblyReferences = activeConfiguredProjectAssemblyReferences;
            _activeConfiguredProjectPackageReferences  = activeConfiguredProjectPackageReferences;
            _activeConfiguredProjectProperties         = activeConfiguredProjectRazorProperties;
        }
Esempio n. 5
0
 public StartupProjectRegistrar(
     IProjectThreadingService threadingService,
     [Import(typeof(IProjectGuidService))] IProjectGuidService2 projectGuidService,
     IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
     ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders)
     : this(AsyncServiceProvider.GlobalProvider, threadingService, projectGuidService, projectSubscriptionService, launchProviders)
 {
 }
 public StartupProjectRegistrar(
     UnconfiguredProject project,
     IProjectThreadingService threadingService,
     IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
     ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders)
     : this(project, AsyncServiceProvider.GlobalProvider, threadingService, projectSubscriptionService, launchProviders)
 {
 }
Esempio n. 7
0
 public VSProjectTestImpl(
     VSLangProj.VSProject vsProject,
     IProjectThreadingService threadingService,
     ActiveConfiguredProject <ProjectProperties> projectProperties,
     UnconfiguredProject project)
     : base(vsProject, threadingService, projectProperties, project)
 {
 }
Esempio n. 8
0
        public PasteOrdering(UnconfiguredProject unconfiguredProject, ActiveConfiguredProject <ConfiguredProject> configuredProject, IProjectAccessor accessor)
        {
            _configuredProject = configuredProject;
            _accessor          = accessor;

            PasteHandlers   = new OrderPrecedenceImportCollection <IPasteHandler>(projectCapabilityCheckProvider: unconfiguredProject);
            PasteProcessors = new OrderPrecedenceImportCollection <IPasteDataObjectProcessor>(projectCapabilityCheckProvider: unconfiguredProject);
        }
 public ActiveWorkspaceProjectContextHost(
     ActiveConfiguredProject <IWorkspaceProjectContextHost> activeHost,
     IActiveConfiguredProjectProvider activeConfiguredProjectProvider,
     IUnconfiguredProjectTasksService tasksService)
 {
     _activeHost = activeHost;
     _activeConfiguredProjectProvider = activeConfiguredProjectProvider;
     _tasksService = tasksService;
 }
 private VisualBasicVSImports CreateInstance(
     VSLangProj.VSProject vsProject            = null,
     IProjectThreadingService threadingService = null,
     ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject = null,
     IProjectAccessor projectAccessor           = null,
     IUnconfiguredProjectVsServices vsServices  = null,
     VisualBasicNamespaceImportsList importList = null)
 {
     return(new VisualBasicVSImports(vsProject, threadingService, activeConfiguredProject, projectAccessor, vsServices, importList));
 }
Esempio n. 11
0
 public TestVisualBasicVSImports(VSLangProj.VSProject vsProject,
                                 IProjectThreadingService threadingService,
                                 ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject,
                                 IProjectAccessor projectAccessor,
                                 IUnconfiguredProjectVsServices unconfiguredProjectVSServices,
                                 TestVisualBasicNamespaceImportsList importsList)
     : base(vsProject, threadingService, activeConfiguredProject, projectAccessor, unconfiguredProjectVSServices, importsList)
 {
     _testImportsList = importsList;
 }
Esempio n. 12
0
 public UnconfiguredProjectCommonServices(UnconfiguredProject project, Lazy <IProjectThreadingService> threadingService,
                                          ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject, ActiveConfiguredProject <ProjectProperties> activeConfiguredProjectProperties,
                                          Lazy <IProjectAccessor> projectAccessor)
 {
     _project                           = project;
     _threadingService                  = threadingService;
     _activeConfiguredProject           = activeConfiguredProject;
     _activeConfiguredProjectProperties = activeConfiguredProjectProperties;
     _projectAccessor                   = projectAccessor;
 }
Esempio n. 13
0
 private StartupProjectRegistrar CreateInstance(
     IVsService <SVsStartupProjectsListService, IVsStartupProjectsListService> startupProjectsListService,
     ActiveConfiguredProject <StartupProjectRegistrar.DebuggerLaunchProviders> launchProviders)
 {
     return(new StartupProjectRegistrar(
                startupProjectsListService,
                IProjectThreadingServiceFactory.Create(),
                IActiveConfiguredProjectSubscriptionServiceFactory.CreateInstance(),
                launchProviders));
 }
 public PhysicalProjectTreeStorage(
     UnconfiguredProject project,
     [Import(ExportContractNames.ProjectTreeProviders.PhysicalProjectTreeService)] IProjectTreeService treeService,
     Lazy <IFileSystem> fileSystem,
     ActiveConfiguredProject <ConfiguredImports> configuredImports)
 {
     _project           = project;
     _treeService       = treeService;
     _fileSystem        = fileSystem;
     _configuredImports = configuredImports;
 }
 public StartupProjectRegistrar(
     IVsService <SVsStartupProjectsListService, IVsStartupProjectsListService> startupProjectsListService,
     IProjectThreadingService threadingService,
     IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService,
     ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders)
 {
     _startupProjectsListService = startupProjectsListService;
     _threadingService           = threadingService;
     _activeConfiguredProjectSubscriptionService = activeConfiguredProjectSubscriptionService;
     _launchProviders = launchProviders;
 }
 public UnconfiguredProjectCommonServices(UnconfiguredProject project, Lazy <IPhysicalProjectTree> projectTree, Lazy <IProjectThreadingService> threadingService,
                                          ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject, ActiveConfiguredProject <ProjectProperties> activeConfiguredProjectProperties,
                                          Lazy <IProjectLockService> projectLockService)
 {
     _project                           = project;
     _projectTree                       = projectTree;
     _threadingService                  = threadingService;
     _activeConfiguredProject           = activeConfiguredProject;
     _activeConfiguredProjectProperties = activeConfiguredProjectProperties;
     _projectLockService                = projectLockService;
 }
        private static VSProject CreateInstance(
            VSLangProj.VSProject vsproject,
            IProjectThreadingService threadingService,
            ActiveConfiguredProject <ProjectProperties> projectProperties,
            UnconfiguredProject?project = null,
            BuildManager?buildManager   = null)
        {
            project ??= UnconfiguredProjectFactory.Create();

            return(new VSProject(vsproject, threadingService, projectProperties, project, buildManager !));
        }
 private StartupProjectRegistrar CreateInstance(
     IUnconfiguredProjectVsServices projectVsServices,
     SVsServiceProvider serviceProvider,
     ActiveConfiguredProject <StartupProjectRegistrar.DebuggerLaunchProviders> launchProviders)
 {
     return(new StartupProjectRegistrar(
                projectVsServices,
                serviceProvider,
                IProjectThreadingServiceFactory.Create(),
                IActiveConfiguredProjectSubscriptionServiceFactory.CreateInstance(),
                launchProviders));
 }
Esempio n. 19
0
        public UnconfiguredProjectCommonServices(UnconfiguredProject project, Lazy <IProjectThreadingService> threadingService, ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject, ActiveConfiguredProject <ProjectProperties> activeConfiguredProjectProperties)
        {
            Requires.NotNull(project, nameof(project));
            Requires.NotNull(threadingService, nameof(threadingService));
            Requires.NotNull(activeConfiguredProject, nameof(activeConfiguredProject));
            Requires.NotNull(activeConfiguredProjectProperties, nameof(activeConfiguredProjectProperties));

            _project                           = project;
            _threadingService                  = threadingService;
            _activeConfiguredProject           = activeConfiguredProject;
            _activeConfiguredProjectProperties = activeConfiguredProjectProperties;
        }
        private static async Task <StartupProjectRegistrar> CreateInitializedInstanceAsync(
            IVsStartupProjectsListService?vsStartupProjectsListService = null,
            IProjectThreadingService?threadingService  = null,
            ISafeProjectGuidService?projectGuidService = null,
            IActiveConfiguredProjectSubscriptionService?projectSubscriptionService = null,
            ActiveConfiguredProject <DebuggerLaunchProviders>?launchProviders      = null)
        {
            var instance = CreateInstance(vsStartupProjectsListService, threadingService, projectGuidService, projectSubscriptionService, launchProviders);
            await instance.InitializeAsync();

            return(instance);
        }
 public PhysicalProjectTreeStorage([Import(ExportContractNames.ProjectTreeProviders.PhysicalProjectTreeService)] Lazy <IProjectTreeService> treeService,
                                   [Import(ExportContractNames.ProjectTreeProviders.PhysicalViewTree)] Lazy <IProjectTreeProvider> treeProvider,
                                   Lazy <IFileSystem> fileSystem,
                                   ActiveConfiguredProject <IFolderManager> folderManager,
                                   UnconfiguredProject project)
 {
     _treeService         = treeService;
     _treeProvider        = treeProvider;
     _fileSystem          = fileSystem;
     _folderManager       = folderManager;
     _unconfiguredProject = project;
 }
Esempio n. 22
0
        internal VSProject(
            [Import(ExportContractNames.VsTypes.CpsVSProject)] VSLangProj.VSProject vsProject,
            IProjectThreadingService threadingService,
            ActiveConfiguredProject <ProjectProperties> projectProperties)
        {
            Requires.NotNull(vsProject, nameof(vsProject));
            Requires.NotNull(threadingService, nameof(threadingService));
            Requires.NotNull(projectProperties, nameof(projectProperties));

            _vsProject         = vsProject;
            _threadingService  = threadingService;
            _projectProperties = projectProperties;
        }
Esempio n. 23
0
        private static VSProject CreateInstance(
            VSLangProj.VSProject vsproject            = null,
            IProjectThreadingService threadingService = null,
            ActiveConfiguredProject <ProjectProperties> projectProperties = null,
            UnconfiguredProject project = null)
        {
            if (project == null)
            {
                project = UnconfiguredProjectFactory.Create();
            }

            return(new VSProject(vsproject, threadingService, projectProperties, project));
        }
Esempio n. 24
0
        internal VSProject(
            [Import(ExportContractNames.VsTypes.CpsVSProject)] VSLangProj.VSProject vsProject,
            IProjectThreadingService threadingService,
            ActiveConfiguredProject <ProjectProperties> projectProperties,
            UnconfiguredProject project)
        {
            _vsProject         = vsProject;
            _threadingService  = threadingService;
            _projectProperties = projectProperties;

            ImportsImpl         = new OrderPrecedenceImportCollection <Imports>(projectCapabilityCheckProvider: project);
            VSProjectEventsImpl = new OrderPrecedenceImportCollection <VSProjectEvents>(projectCapabilityCheckProvider: project);
        }
Esempio n. 25
0
        private async Task <StartupProjectRegistrar> CreateInitializedInstanceAsync(
            UnconfiguredProject project           = null,
            IAsyncServiceProvider serviceProvider = null,
            IVsStartupProjectsListService vsStartupProjectsListService = null,
            IProjectThreadingService threadingService = null,
            IProjectGuidService2 projectGuidService   = null,
            IActiveConfiguredProjectSubscriptionService projectSubscriptionService = null,
            ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders      = null)
        {
            var instance = CreateInstance(project, serviceProvider, vsStartupProjectsListService, threadingService, projectGuidService, projectSubscriptionService, launchProviders);
            await instance.InitializeAsync();

            return(instance);
        }
 public StartupProjectRegistrar(
     UnconfiguredProject project,
     IVsService <SVsStartupProjectsListService, IVsStartupProjectsListService> startupProjectsListService,
     IProjectThreadingService threadingService,
     ISafeProjectGuidService projectGuidService,
     IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
     ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders)
     : base(threadingService.JoinableTaskContext)
 {
     _startupProjectsListService = startupProjectsListService;
     _projectGuidService         = projectGuidService;
     _projectSubscriptionService = projectSubscriptionService;
     _launchProviders            = launchProviders;
 }
Esempio n. 27
0
 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 StartupProjectRegistrar(
            UnconfiguredProject project,
            IAsyncServiceProvider serviceProvider,
            IProjectThreadingService threadingService,
            IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
            ActiveConfiguredProject <DebuggerLaunchProviders> launchProviders)
            : base(threadingService.JoinableTaskContext)
        {
            _serviceProvider            = serviceProvider;
            _threadingService           = threadingService;
            _projectSubscriptionService = projectSubscriptionService;
            _launchProviders            = launchProviders;

            ProjectGuidServices = new OrderPrecedenceImportCollection <IProjectGuidService>(projectCapabilityCheckProvider: project);
        }
        public LaunchSettingsProvider(UnconfiguredProject project, IUnconfiguredProjectServices projectServices,
                                      IFileSystem fileSystem, IUnconfiguredProjectCommonServices commonProjectServices,
                                      IActiveConfiguredProjectSubscriptionService projectSubscriptionService,
                                      ActiveConfiguredProject <AppDesignerFolderSpecialFileProvider> appDesignerSpecialFileProvider)
        {
            ProjectServices            = projectServices;
            FileManager                = fileSystem;
            CommonProjectServices      = commonProjectServices;
            JsonSerializationProviders = new OrderPrecedenceImportCollection <ILaunchSettingsSerializationProvider, IJsonSection>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                                                                                                                                  project);
            SourceControlIntegrations = new OrderPrecedenceImportCollection <ISourceCodeControlIntegration>(projectCapabilityCheckProvider: project);

            ProjectSubscriptionService      = projectSubscriptionService;
            _appDesignerSpecialFileProvider = appDesignerSpecialFileProvider;
            _launchSettingsFilePath         = new AsyncLazy <string>(GetLaunchSettingsFilePathNoCacheAsync, commonProjectServices.ThreadingService.JoinableTaskFactory);
        }
Esempio n. 30
0
        public void BuildMacroInfoTests_GetBuildMacroValue(string macroName, string expectedValue, int expectedRetVal)
        {
            var projectProperties         = IProjectPropertiesFactory.CreateWithPropertyAndValue("MyBuildMacro", "MyBuildMacroValue");
            var propertiesProvider        = IProjectPropertiesProviderFactory.Create(commonProps: projectProperties);
            var configuredProjectServices = Mock.Of <IConfiguredProjectServices>(o =>
                                                                                 o.ProjectPropertiesProvider == propertiesProvider);
            var configuredProject = ConfiguredProjectFactory.Create(services: configuredProjectServices);
            ActiveConfiguredProject <ConfiguredProject> activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => configuredProject);
            var threadingService = IProjectThreadingServiceFactory.Create();

            var buildMacroInfo = new BuildMacroInfo(activeConfiguredProject, threadingService);
            int retVal         = buildMacroInfo.GetBuildMacroValue(macroName, out string macroValue);

            Assert.Equal(expectedRetVal, retVal);
            Assert.Equal(expectedValue, macroValue);
        }