Skip to content

Commit

Permalink
Ensure IServiceBroker is used on a background thread
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Sep 21, 2020
1 parent ffa4e6d commit 42202d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ public override async ValueTask<RemoteServiceConnection<T>> CreateConnectionAsyn

var descriptor = ServiceDescriptors.GetServiceDescriptor(typeof(T), RemoteHostOptions.IsServiceHubProcess64Bit(_services));

// Make sure we are on the thread pool to avoid UI thread dependencies if external code uses ConfigureAwait(true)
await TaskScheduler.Default;

#pragma warning disable ISB001 // Dispose of proxies - BrokeredServiceConnection takes care of disposal
var proxy = await _serviceBroker.GetProxyAsync<T>(descriptor, options, cancellationToken).ConfigureAwait(false);
#pragma warning restore
Expand Down

0 comments on commit 42202d8

Please sign in to comment.