public static async Task FindImplementationsAsync( ISymbol symbol, Project project, IFindUsagesContext context) { var cancellationToken = context.CancellationToken; var solution = project.Solution; var client = await RemoteHostClient.TryGetClientAsync(solution.Workspace, cancellationToken).ConfigureAwait(false); if (client != null) { // Create a callback that we can pass to the server process to hear about the // results as it finds them. When we hear about results we'll forward them to // the 'progress' parameter which will then update the UI. var serverCallback = new FindUsagesServerCallback(solution, context); var symbolAndProjectId = SerializableSymbolAndProjectId.Create(symbol, project, cancellationToken); await client.TryInvokeAsync <IRemoteFindUsagesService>( solution, (service, solutionInfo, cancellationToken) => service.FindImplementationsAsync(solutionInfo, symbolAndProjectId, cancellationToken), serverCallback, cancellationToken).ConfigureAwait(false); } else { // Couldn't effectively search in OOP. Perform the search in-process. await FindImplementationsInCurrentProcessAsync( symbol, project, context).ConfigureAwait(false); } }
public static async Task FindImplementationsAsync( ISymbol symbol, Project project, IFindUsagesContext context) { var cancellationToken = context.CancellationToken; var solution = project.Solution; var client = await RemoteHostClient.TryGetClientAsync(solution.Workspace, cancellationToken).ConfigureAwait(false); if (client != null) { // Create a callback that we can pass to the server process to hear about the // results as it finds them. When we hear about results we'll forward them to // the 'progress' parameter which will then update the UI. var serverCallback = new FindUsagesServerCallback(solution, context); var success = await client.TryRunRemoteAsync( WellKnownServiceHubServices.CodeAnalysisService, nameof(IRemoteFindUsagesService.FindImplementationsAsync), solution, new object[] { SerializableSymbolAndProjectId.Create(symbol, project, cancellationToken), }, serverCallback, cancellationToken).ConfigureAwait(false); if (success) { return; } } // Couldn't effectively search in OOP. Perform the search in-process. await FindImplementationsInCurrentProcessAsync( symbol, project, context).ConfigureAwait(false); }