Example #1
0
        public async ValueTask <ImmutableArray <(Checksum, object)> > GetAssetsAsync(int scopeId, ISet <Checksum> checksums, ISerializerService serializerService, CancellationToken cancellationToken)
        {
            using var provider = await _client.GetProxyAsync <ISolutionAssetProvider>(SolutionAssetProvider.ServiceDescriptor, cancellationToken).ConfigureAwait(false);

            Contract.ThrowIfNull(provider.Proxy);

            return(await new RemoteCallback <ISolutionAssetProvider>(provider.Proxy, _clientDisconnectedSource).InvokeAsync(
                       (proxy, stream, cancellationToken) => proxy.GetAssetsAsync(stream, scopeId, checksums.ToArray(), cancellationToken),
                       (stream, cancellationToken) => RemoteHostAssetSerialization.ReadDataAsync(stream, scopeId, checksums, serializerService, cancellationToken),
                       cancellationToken).ConfigureAwait(false));
        }
Example #2
0
        public async ValueTask <ImmutableArray <(Checksum, object)> > GetAssetsAsync(Checksum solutionChecksum, ISet <Checksum> checksums, ISerializerService serializerService, CancellationToken cancellationToken)
        {
            // Make sure we are on the thread pool to avoid UI thread dependencies if external code uses ConfigureAwait(true)
            await TaskScheduler.Default;

            return(await RemoteCallback <ISolutionAssetProvider> .InvokeServiceAsync(
                       _client,
                       SolutionAssetProvider.ServiceDescriptor,
                       (callback, cancellationToken) => callback.InvokeAsync(
                           (proxy, pipeWriter, cancellationToken) => proxy.GetAssetsAsync(pipeWriter, solutionChecksum, checksums.ToArray(), cancellationToken),
                           (pipeReader, cancellationToken) => RemoteHostAssetSerialization.ReadDataAsync(pipeReader, solutionChecksum, checksums, serializerService, cancellationToken),
                           cancellationToken),
                       cancellationToken).ConfigureAwait(false));
        }
Example #3
0
        public async ValueTask <ImmutableArray <(Checksum, object)> > GetAssetsAsync(int scopeId, ISet <Checksum> checksums, ISerializerService serializerService, CancellationToken cancellationToken)
        {
            // Make sure we are on the thread pool to avoid UI thread dependencies if external code uses ConfigureAwait(true)
            await TaskScheduler.Default;

            using var provider = await _client.GetProxyAsync <ISolutionAssetProvider>(SolutionAssetProvider.ServiceDescriptor, cancellationToken).ConfigureAwait(false);

            Contract.ThrowIfNull(provider.Proxy);

            return(await new RemoteCallback <ISolutionAssetProvider>(provider.Proxy, _clientDisconnectedSource).InvokeAsync(
                       (proxy, pipeWriter, cancellationToken) => proxy.GetAssetsAsync(pipeWriter, scopeId, checksums.ToArray(), cancellationToken),
                       (pipeReader, cancellationToken) => RemoteHostAssetSerialization.ReadDataAsync(pipeReader, scopeId, checksums, serializerService, cancellationToken),
                       cancellationToken).ConfigureAwait(false));
        }