public Task ActivateAsync()
        {
            _telemetryPackageRestoreProgressTrackerId++;
            _packageReferenceTelemetryService.PostPackageRestoreEvent(PackageRestoreOperationNames.PackageRestoreProgressTrackerActivating, _telemetryPackageRestoreProgressTrackerId);

            return(LoadAsync());
        }
Ejemplo n.º 2
0
            protected override Task InitializeCoreAsync(CancellationToken cancellationToken)
            {
                _joinedDataSources = ProjectDataSources.JoinUpstreamDataSources(JoinableFactory, _projectFaultHandlerService, _projectSubscriptionService.ProjectSource, _dataSource);

                _progressRegistration = _dataProgressTrackerService.RegisterOutputDataSource(this);

                Action <IProjectVersionedValue <ValueTuple <IProjectSnapshot, RestoreData> > > action = OnRestoreCompleted;

                _subscription = ProjectDataSources.SyncLinkTo(
                    _projectSubscriptionService.ProjectSource.SourceBlock.SyncLinkOptions(),
                    _dataSource.SourceBlock.SyncLinkOptions(),
                    DataflowBlockFactory.CreateActionBlock(action, ConfiguredProject.UnconfiguredProject, ProjectFaultSeverity.LimitedFunctionality),
                    linkOptions: DataflowOption.PropagateCompletion,
                    cancellationToken: cancellationToken);

                _packageReferenceTelemetryService.PostPackageRestoreEvent(PackageRestoreOperationNames.PackageRestoreProgressTrackerInstanceInitialized, _packageRestoreProgressTrackerId);

                return(Task.CompletedTask);
            }
Ejemplo n.º 3
0
        protected override IDisposable LinkExternalInput(ITargetBlock <RestoreUpdate> targetBlock)
        {
            IProjectValueDataSource <IProjectSubscriptionUpdate> source = _projectSubscriptionService.JointRuleSource;

            // Transform the changes from evaluation/design-time build -> restore data
            DisposableValue <ISourceBlock <RestoreUpdate> > transformBlock = source.SourceBlock.TransformWithNoDelta(update => update.Derive(u => CreateRestoreInput(u.ProjectConfiguration, u.CurrentState)),
                                                                                                                     suppressVersionOnlyUpdates: false, // We need to coordinate these at the unconfigured-level
                                                                                                                     ruleNames: s_rules);

            // Set the link up so that we publish changes to target block
            transformBlock.Value.LinkTo(targetBlock, DataflowOption.PropagateCompletion);

            // Join the source blocks, so if they need to switch to UI thread to complete
            // and someone is blocked on us on the same thread, the call proceeds
            JoinUpstreamDataSources(source);

            _packageReferenceTelemetryService.PostPackageRestoreEvent(PackageRestoreOperationNames.PackageRestoreConfiguredInputDataSourceLinkedToExternalInput);

            return(transformBlock);
        }