Exemple #1
0
        protected override async Task InitializeCoreAsync(CancellationToken cancellationToken)
        {
            await base.InitializeCoreAsync(cancellationToken);

            _broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <RestoreData> >();
            _publicBlock    = _broadcastBlock.SafePublicize();
        }
Exemple #2
0
        protected override void Initialize()
        {
            // Create our broadcast block for subscribers to get new ILaunchProfiles Information
            _broadcastBlock     = DataflowBlockSlim.CreateBroadcastBlock <ILaunchSettings>();
            _changedSourceBlock = _broadcastBlock.SafePublicize();


            // Subscribe to changes to the broadcast block using the idle scheduler. This should filter out a lot of the intermediates
            // states that files can be in.
            if (_projectSubscriptionService != null)
            {
                // The use of AsyncLazy with dataflow can allow state stored in the execution context to leak through. The downstream affect is
                // calls to say, get properties, may fail. To avoid this, we capture the execution context here, and it will be reapplied when
                // we get new subscription data from the dataflow.
                ITargetBlock <IProjectVersionedValue <Tuple <IProjectSubscriptionUpdate, IProjectCapabilitiesSnapshot> > > projectChangesBlock = DataflowBlockSlim.CreateActionBlock(
                    DataflowUtilities.CaptureAndApplyExecutionContext <IProjectVersionedValue <Tuple <IProjectSubscriptionUpdate, IProjectCapabilitiesSnapshot> > >(ProjectRuleBlock_ChangedAsync));
                StandardRuleDataflowLinkOptions evaluationLinkOptions = DataflowOption.WithRuleNames(ProjectDebugger.SchemaName);

                _projectRuleSubscriptionLink = ProjectDataSources.SyncLinkTo(
                    _projectSubscriptionService.ProjectRuleSource.SourceBlock.SyncLinkOptions(evaluationLinkOptions),
                    _commonProjectServices.Project.Capabilities.SourceBlock.SyncLinkOptions(),
                    projectChangesBlock,
                    linkOptions: DataflowOption.PropagateCompletion);
            }

            // Make sure we are watching the file at this point
            WatchLaunchSettingsFile();
        }
Exemple #3
0
        protected override void Initialize()
        {
            base.Initialize();

            // Create an action block to process the design time inputs and configuration general changes
            ITargetBlock <IProjectVersionedValue <ValueTuple <DesignTimeInputs, IProjectSubscriptionUpdate> > > inputsAction = DataflowBlockSlim.CreateActionBlock <IProjectVersionedValue <ValueTuple <DesignTimeInputs, IProjectSubscriptionUpdate> > >(ProcessDataflowChanges);

            _broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <DesignTimeInputsDelta> >(nameFormat: nameof(DesignTimeInputsChangeTracker) + "Broadcast {1}");
            _publicBlock    = AllowSourceBlockCompletion ? _broadcastBlock : _broadcastBlock.SafePublicize();

            Assumes.Present(_project.Services.ProjectAsynchronousTasks);

            IDisposable projectLink = ProjectDataSources.SyncLinkTo(
                _inputsDataSource.SourceBlock.SyncLinkOptions(
                    linkOptions: DataflowOption.PropagateCompletion),
                _projectSubscriptionService.ProjectRuleSource.SourceBlock.SyncLinkOptions(
                    linkOptions: DataflowOption.WithRuleNames(ConfigurationGeneral.SchemaName)),
                inputsAction,
                DataflowOption.PropagateCompletion,
                cancellationToken: _project.Services.ProjectAsynchronousTasks.UnloadCancellationToken);

            // Create an action block to process file change notifications
            ITargetBlock <IProjectVersionedValue <string[]> > fileWatcherAction = DataflowBlockSlim.CreateActionBlock <IProjectVersionedValue <string[]> >(ProcessFileChangeNotification);
            IDisposable watcherLink = _fileWatcher.SourceBlock.LinkTo(fileWatcherAction, DataflowOption.PropagateCompletion);

            _disposables.Add(projectLink);
            _disposables.Add(watcherLink);

            JoinUpstreamDataSources(_inputsDataSource, _projectSubscriptionService.ProjectRuleSource, _fileWatcher);
        }
        protected override void Initialize()
        {
            IPropagatorBlock <IProjectVersionedValue <ILaunchSettings>, IProjectVersionedValue <IReadOnlyList <IEnumValue> > > debugProfilesBlock = DataflowBlockSlim.CreateTransformBlock <IProjectVersionedValue <ILaunchSettings>, IProjectVersionedValue <IReadOnlyList <IEnumValue> > >(
                update =>
            {
                // Compute the new enum values from the profile provider
                var generatedResult = DebugProfileEnumValuesGenerator.GetEnumeratorEnumValues(update.Value).ToImmutableList();
                _dataSourceVersion++;
                ImmutableDictionary <NamedIdentity, IComparable> dataSources = ImmutableDictionary <NamedIdentity, IComparable> .Empty.Add(DataSourceKey, DataSourceVersion);
                return(new ProjectVersionedValue <IReadOnlyList <IEnumValue> >(generatedResult, dataSources));
            });

            IBroadcastBlock <IProjectVersionedValue <IReadOnlyList <IEnumValue> > > broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <IReadOnlyList <IEnumValue> > >();

            // The interface has two definitions of SourceBlock: one from
            // ILaunchSettingsProvider, and one from IProjectValueDataSource<T> (via
            // IVersionedLaunchSettingsProvider). We need the cast to pick the proper one.
            _launchProfileProviderLink = ((IProjectValueDataSource <ILaunchSettings>)LaunchSettingProvider).SourceBlock.LinkTo(
                debugProfilesBlock,
                linkOptions: DataflowOption.PropagateCompletion);

            JoinUpstreamDataSources(LaunchSettingProvider);

            _debugProviderLink = debugProfilesBlock.LinkTo(broadcastBlock, DataflowOption.PropagateCompletion);

            _publicBlock = broadcastBlock.SafePublicize();
        }
        protected override void Initialize()
        {
            base.Initialize();

            _broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <string[]> >(nameFormat: nameof(DesignTimeInputsFileWatcher) + "Broadcast {1}");
            _publicBlock    = AllowSourceBlockCompletion ? _broadcastBlock : _broadcastBlock.SafePublicize();

            _actionBlock = DataflowBlockFactory.CreateActionBlock <IProjectVersionedValue <DesignTimeInputs> >(ProcessDesignTimeInputs, _project);

            _dataSourceLink = _designTimeInputsDataSource.SourceBlock.LinkTo(_actionBlock, DataflowOption.PropagateCompletion);

            JoinUpstreamDataSources(_designTimeInputsDataSource);
        }
        protected override void Initialize()
        {
            base.Initialize();

            IDisposable projectRuleSourceLink = _project.Services.ProjectSubscription.ProjectRuleSource.SourceBlock.LinkToAsyncAction(ProcessProjectChanged, ruleNames: PotentialEditorConfigFiles.SchemaName);

            IDisposable join = JoinUpstreamDataSources(_project.Services.ProjectSubscription.ProjectRuleSource);

            _disposables = new DisposableBag();
            _disposables.AddDisposable(projectRuleSourceLink);
            _disposables.AddDisposable(join);

            _broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <FileWatchData> >(nameFormat: nameof(PotentialEditorConfigDataSource) + "Broadcast {1}");
            _publicBlock    = _broadcastBlock.SafePublicize();
        }
Exemple #7
0
        protected override void Initialize()
        {
            IPropagatorBlock <ILaunchSettings, IProjectVersionedValue <IReadOnlyList <IEnumValue> > > debugProfilesBlock = DataflowBlockSlim.CreateTransformBlock <ILaunchSettings, IProjectVersionedValue <IReadOnlyList <IEnumValue> > >(
                update =>
            {
                // Compute the new enum values from the profile provider
                var generatedResult = DebugProfileEnumValuesGenerator.GetEnumeratorEnumValues(update).ToImmutableList();
                _dataSourceVersion++;
                ImmutableDictionary <NamedIdentity, IComparable> dataSources = ImmutableDictionary <NamedIdentity, IComparable> .Empty.Add(DataSourceKey, DataSourceVersion);
                return(new ProjectVersionedValue <IReadOnlyList <IEnumValue> >(generatedResult, dataSources));
            });

            IBroadcastBlock <IProjectVersionedValue <IReadOnlyList <IEnumValue> > > broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <IReadOnlyList <IEnumValue> > >();

            _launchProfileProviderLink = LaunchSettingProvider.SourceBlock.LinkTo(
                debugProfilesBlock,
                linkOptions: DataflowOption.PropagateCompletion);

            _debugProviderLink = debugProfilesBlock.LinkTo(broadcastBlock, DataflowOption.PropagateCompletion);

            _publicBlock = broadcastBlock.SafePublicize();
        }