/// <summary> /// Run given service on remote host. if it fails to run on remote host, it will return default(T) /// </summary> public static async Task <T> TryRunRemoteAsync <T>( this RemoteHostClient client, string serviceName, Solution solution, string targetName, IReadOnlyList <object> arguments, CancellationToken cancellationToken) { using (var session = await client.TryCreateSessionAsync(serviceName, solution, cancellationToken).ConfigureAwait(false)) { if (session == null) { // can't create Session. RemoteHost seems not responding for some reasons such as OOP gone. return(default);
public static Task <SessionWithSolution> TryCreateCodeAnalysisSessionAsync( this RemoteHostClient client, Solution solution, object callbackTarget, CancellationToken cancellationToken) => client.TryCreateSessionAsync(WellKnownServiceHubServices.CodeAnalysisService, solution, callbackTarget, cancellationToken);
/// <summary> /// Create <see cref="SessionWithSolution"/> for the <paramref name="serviceName"/> if possible. /// otherwise, return null. /// /// Creating session could fail if remote host is not available. one of example will be user killing /// remote host. /// </summary> public static Task <SessionWithSolution> TryCreateSessionAsync( this RemoteHostClient client, string serviceName, Solution solution, CancellationToken cancellationToken) => client.TryCreateSessionAsync(serviceName, solution, callbackTarget: null, cancellationToken: cancellationToken);