public async Task <ILaunchProfile?> AddLaunchProfileAsync(string commandName, string?newProfileName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); newProfileName ??= await GetNewProfileNameAsync(cancellationToken); await _launchSettingsProvider.AddOrUpdateProfileAsync( new WritableLaunchProfile { Name = newProfileName, CommandName = commandName }.ToLaunchProfile(), addToFront : false); return(_launchSettingsProvider.CurrentSnapshot?.Profiles.FirstOrDefault(p => StringComparers.LaunchProfileNames.Equals(newProfileName, p.Name))); }
protected override Task ExecuteAsync(ILaunchSettingsProvider launchSettingsProvider, CancellationToken cancellationToken) { return(launchSettingsProvider.AddOrUpdateProfileAsync( new WritableLaunchProfile { Name = _executableStep.NewProfileName, CommandName = _executableStep.CommandName }.ToLaunchProfile(), addToFront: false)); }
public async Task <EntityIdentity?> AddLaunchProfileAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, string commandName, string?newProfileName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); newProfileName ??= await GetNewProfileNameAsync(cancellationToken); await _launchSettingsProvider.AddOrUpdateProfileAsync( new WritableLaunchProfile { Name = newProfileName, CommandName = commandName }.ToLaunchProfile(), addToFront : false); if (_launchSettingsProvider.CurrentSnapshot is IVersionedLaunchSettings versionedLaunchSettings) { queryExecutionContext.ReportUpdatedDataVersion(_launchSettingsTracker.VersionKey, versionedLaunchSettings.Version); } return(CreateLaunchProfileId(parent, newProfileName)); }
protected override async Task ExecuteAsync(ILaunchSettingsProvider launchSettingsProvider, CancellationToken cancellationToken) { ILaunchSettings?launchSettings = await launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite).WithCancellation(cancellationToken); Assumes.NotNull(launchSettings); ILaunchProfile?existingProfile = launchSettings.Profiles.FirstOrDefault(p => StringComparers.LaunchProfileNames.Equals(p.Name, _executableStep.CurrentProfileName)); if (existingProfile is not null) { var writableProfile = new WritableLaunchProfile(existingProfile); writableProfile.Name = _executableStep.NewProfileName; writableProfile.CommandName = _executableStep.NewProfileCommandName; await launchSettingsProvider.AddOrUpdateProfileAsync(writableProfile.ToLaunchProfile(), addToFront : false); } }
internal async Task InitializeAsync() { SubscribeToLaunchSettings(); ILaunchSettings launchSettings = await _launchSettingsProvider.SourceBlock.ReceiveAsync().ConfigureAwait(false); try { ConfiguredProject configuredProject = await _project.GetSuggestedConfiguredProjectAsync().ConfigureAwait(false); IEnumerable <ILaunchProfile> launchProfiles = launchSettings?.Profiles ?? Enumerable.Empty <ILaunchProfile>(); LaunchProfile profile = await CreateDefaultLaunchProfile(configuredProject, launchProfiles); await _launchSettingsProvider.AddOrUpdateProfileAsync(profile, addToFront : false).ConfigureAwait(false); } catch (Exception e) when(!(e is OperationCanceledException)) { Assumes.Fail(e.ToString()); } }