Skip to content

Commit c020fe8

Browse files
committed
Wait for GetAssetsAsync before returning
1 parent ebb674f commit c020fe8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Workspaces/Remote/Core/SolutionAssetProvider.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checks
5959
// (non-contiguous) memory allocated for the underlying buffers. The amount of memory is bounded by the total size of the serialized assets.
6060
var localPipe = new Pipe(RemoteHostAssetSerialization.PipeOptionsWithUnlimitedWriterBuffer);
6161

62-
Task.Run(() =>
62+
var task1 = Task.Run(() =>
6363
{
6464
try
6565
{
@@ -71,12 +71,14 @@ public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checks
7171
{
7272
// no-op
7373
}
74-
}, cancellationToken).Forget();
74+
}, cancellationToken);
7575

7676
// Complete RPC once we send the initial piece of data and start waiting for the writer to send more,
7777
// so the client can start reading from the stream. Once CopyPipeDataAsync completes the pipeWriter
7878
// the corresponding client-side pipeReader will complete and the data transfer will be finished.
79-
CopyPipeDataAsync().Forget();
79+
var task2 = CopyPipeDataAsync();
80+
81+
await Task.WhenAll(task1, task2).ConfigureAwait(false);
8082

8183
async Task CopyPipeDataAsync()
8284
{

0 commit comments

Comments
 (0)