コード例 #1
0
        public async Task <EnumCollection> GetListedValuesAsync()
        {
            using (JoinableCollection.Join())
            {
                EnumCollectionProjectValue snapshot = await SourceBlock.ReceiveAsync();

                return(snapshot.Value);
            }
        }
コード例 #2
0
        public async Task <ImmutableArray <string> > GetArgsAsync()
        {
            using (JoinableCollection.Join())
            {
                await this.InitializeAsync().ConfigureAwait(true);

                return(this.AppliedValue?.Value ?? ImmutableArray <string> .Empty);
            }
        }
コード例 #3
0
 protected async Task ExecuteWithLock(Func <Task> func)
 {
     using (JoinableCollection.Join())
     {
         using (await _lock.EnterAsync().ConfigureAwait(false))
         {
             var task = JoinableFactory.RunAsync(func);
             await task.Task.ConfigureAwait(false);
         }
     }
 }
コード例 #4
0
 private JoinableTask ExecuteWithinLockAsync(Func <Task> task)
 {
     // We need to request the lock within a joinable task to ensure that if we are blocking the UI
     // thread (i.e. when CPS is draining critical tasks on the UI thread and is waiting on this task),
     // and the lock is already held by another task requesting UI thread access, we don't reach a deadlock.
     return(JoinableFactory.RunAsync(async delegate
     {
         using (JoinableCollection.Join())
             using (await _gate.DisposableWaitAsync().ConfigureAwait(false))
             {
                 await task().ConfigureAwait(false);
             }
     }));
 }
コード例 #5
0
        public async Task <EnumCollection> GetListedValuesAsync()
        {
            if (!IsReadyToBuild())
            {
                throw new InvalidOperationException("This configuration is not set to build");
            }

            // NOTE: This has a race, if called off the UI thread, the configuration could become
            // inactive underneath us and hence not ready for build, causing below to block forever.

            using (JoinableCollection.Join())
            {
                EnumCollectionProjectValue snapshot = await SourceBlock.ReceiveAsync();

                return(snapshot.Value);
            }
        }
        public async Task <EnumCollection> GetListedValuesAsync()
        {
            if (!IsReadyToBuild())
            {
                throw new InvalidOperationException("This configuration is not set to build");
            }

            // NOTE: This has a race, if called off the UI thread, the configuration could become
            // inactive underneath us and hence not ready for build, causing below to block forever.

            using (JoinableCollection.Join())
            {
                EnumCollectionProjectValue snapshot = await SourceBlock.ReceiveAsync();

                // TODO: This is a hotfix for item ordering. Remove this OrderBy when completing: https://github.com/dotnet/project-system/issues/7025
                return(snapshot.Value.OrderBy(e => e.DisplayName).ToArray());
            }
        }
コード例 #7
0
 public IDisposable?Join()
 {
     return(JoinableCollection.Join());
 }