internal static async Task <ConflictResolution> ResolveConflictsAsync( RenameLocations renameLocationSet, string replacementText, ImmutableHashSet <ISymbol> nonConflictSymbols, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (Logger.LogBlock(FunctionId.Renamer_FindRenameLocationsAsync, cancellationToken)) { var solution = renameLocationSet.Solution; var client = await RemoteHostClient.TryGetClientAsync(solution.Workspace, cancellationToken).ConfigureAwait(false); if (client != null) { var result = await client.TryRunRemoteAsync <SerializableConflictResolution>( WellKnownServiceHubServices.CodeAnalysisService, nameof(IRemoteRenamer.ResolveConflictsAsync), solution, new object[] { renameLocationSet.Dehydrate(solution, cancellationToken), replacementText, nonConflictSymbols?.Select(s => SerializableSymbolAndProjectId.Dehydrate(solution, s, cancellationToken)).ToArray(), }, callbackTarget : null, cancellationToken).ConfigureAwait(false); if (result.HasValue) { return(await result.Value.RehydrateAsync(solution, cancellationToken).ConfigureAwait(false)); } } } return(await ResolveConflictsInCurrentProcessAsync( renameLocationSet, replacementText, nonConflictSymbols, cancellationToken).ConfigureAwait(false)); }
internal static async Task <ConflictResolution> ResolveConflictsAsync( RenameLocations renameLocationSet, string replacementText, ImmutableHashSet <ISymbol>?nonConflictSymbols, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (Logger.LogBlock(FunctionId.Renamer_FindRenameLocationsAsync, cancellationToken)) { var solution = renameLocationSet.Solution; var client = await RemoteHostClient.TryGetClientAsync(solution.Workspace, cancellationToken).ConfigureAwait(false); if (client != null) { var serializableLocationSet = renameLocationSet.Dehydrate(solution, cancellationToken); var nonConflictSymbolIds = nonConflictSymbols?.SelectAsArray(s => SerializableSymbolAndProjectId.Dehydrate(solution, s, cancellationToken)) ?? default; var result = await client.TryInvokeAsync <IRemoteRenamerService, SerializableConflictResolution?>( solution, (service, solutionInfo, cancellationToken) => service.ResolveConflictsAsync(solutionInfo, serializableLocationSet, replacementText, nonConflictSymbolIds, cancellationToken), callbackTarget : null, cancellationToken).ConfigureAwait(false); if (result.HasValue && result.Value != null) { return(await result.Value.RehydrateAsync(solution, cancellationToken).ConfigureAwait(false)); } // TODO: do not fall back to in-proc if client is available (https://github.com/dotnet/roslyn/issues/47557) } } return(await ResolveConflictsInCurrentProcessAsync( renameLocationSet, replacementText, nonConflictSymbols, cancellationToken).ConfigureAwait(false)); }