public static async Task <IEntityValue?> CreatePropertyPageValueAsync( IQueryExecutionContext queryExecutionContext, EntityIdentity id, IProjectService2 projectService, IProjectStateProvider projectStateProvider, QueryProjectPropertiesContext propertiesContext, string propertyPageName, IPropertyPagePropertiesAvailableStatus requestedProperties) { if (projectService.GetLoadedProject(propertiesContext.File) is UnconfiguredProject project) { project.GetQueryDataVersion(out string versionKey, out long versionNumber); queryExecutionContext.ReportInputDataVersion(versionKey, versionNumber); if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog && projectCatalog.GetSchema(propertyPageName) is Rule rule && !rule.PropertyPagesHidden) { IProjectState projectState = projectStateProvider.CreateState(project); IEntityValue propertyPageValue = CreatePropertyPageValue(queryExecutionContext, id, projectState, propertiesContext, rule, requestedProperties); return(propertyPageValue); } } return(null); }
protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id) { string projectPath = ValidateIdAndExtractProjectPath(id); if (_projectService.GetLoadedProject(projectPath) is UnconfiguredProject project && project.Services.ExportProvider.GetExportedValueOrDefault <IProjectLaunchProfileHandler>() is IProjectLaunchProfileHandler launchProfileHandler) { return(launchProfileHandler.RetrieveLaunchProfileEntityAsync(queryExecutionContext, id, _properties)); } return(NullEntityValue); }
private async Task <IEntityValue?> CreateLaunchProfileValueAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id, QueryProjectPropertiesContext propertiesContext) { if (_projectService.GetLoadedProject(propertiesContext.File) is UnconfiguredProject project && project.Services.ExportProvider.GetExportedValueOrDefault <ILaunchSettingsProvider>() is ILaunchSettingsProvider launchSettingsProvider && project.Services.ExportProvider.GetExportedValueOrDefault <LaunchSettingsTracker>() is LaunchSettingsTracker launchSettingsTracker && await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog && await launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite) is ILaunchSettings launchSettings) { if (launchSettings is IVersionedLaunchSettings versionedLaunchSettings) { queryExecutionContext.ReportInputDataVersion(launchSettingsTracker.VersionKey, versionedLaunchSettings.Version); } IProjectState projectState = new LaunchProfileProjectState(project, launchSettingsProvider, launchSettingsTracker); foreach ((int index, ProjectSystem.Debug.ILaunchProfile profile) in launchSettings.Profiles.WithIndices()) { if (StringComparers.LaunchProfileNames.Equals(profile.Name, propertiesContext.ItemName) && !Strings.IsNullOrEmpty(profile.CommandName)) { foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog)) { if (rule.Metadata.TryGetValue("CommandName", out object?commandNameObj) && commandNameObj is string commandName && StringComparers.LaunchProfileCommandNames.Equals(commandName, profile.CommandName)) { IEntityValue launchProfileValue = LaunchProfileDataProducer.CreateLaunchProfileValue( queryExecutionContext, id, propertiesContext, rule, index, projectState, _properties); return(launchProfileValue); } } } } } return(null); }