public static async Task <bool> TryRunRemoteAsync( this RemoteHostClient client, string serviceName, string targetName, IReadOnlyList <object> arguments, CancellationToken cancellationToken) { using (var connection = await client.TryCreateConnectionAsync(serviceName, cancellationToken).ConfigureAwait(false)) { if (connection == null) { // can't create Connection. RemoteHost seems not responding for some reasons such as OOP gone. return(false); } await connection.InvokeAsync(targetName, arguments, cancellationToken).ConfigureAwait(false); return(true); } }
public void Shutdown() { ReferenceCountedDisposable <RemoteHostClient.Connection> connection; lock (_gate) { if (_client != null) { _client.StatusChanged -= OnStatusChanged; } connection = _connectionDoNotAccessDirectly; _client = null; _connectionDoNotAccessDirectly = null; } connection?.Dispose(); }
public static Task <KeepAliveSession> TryCreateCodeAnalysisKeepAliveSessionAsync( this RemoteHostClient client, CancellationToken cancellationToken) => TryCreateCodeAnalysisKeepAliveSessionAsync(client, callbackTarget: null, cancellationToken: cancellationToken);
public static Task <SessionWithSolution> TryCreateCodeAnalysisSessionAsync( this RemoteHostClient client, Solution solution, object callbackTarget, CancellationToken cancellationToken) => client.TryCreateSessionAsync(WellKnownServiceHubServices.CodeAnalysisService, solution, callbackTarget, cancellationToken);
public static Task <SessionWithSolution> TryCreateCodeAnalysisSessionAsync( this RemoteHostClient client, Solution solution, CancellationToken cancellationToken) => TryCreateCodeAnalysisSessionAsync(client, solution, callbackTarget: null, cancellationToken: cancellationToken);
/// <summary> /// Create <see cref="KeepAliveSession"/> 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 <KeepAliveSession> TryCreateKeepAliveSessionAsync( this RemoteHostClient client, string serviceName, CancellationToken cancellationToken) => TryCreateKeepAliveSessionAsync(client, serviceName, callbackTarget: null, cancellationToken: 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);
/// <summary> /// Create <see cref="RemoteHostClient.Connection"/> for the <paramref name="serviceName"/> if possible. /// otherwise, return null. /// /// Creating connection could fail if remote host is not available. one of example will be user killing /// remote host. /// </summary> public static Task <RemoteHostClient.Connection> TryCreateConnectionAsync( this RemoteHostClient client, string serviceName, CancellationToken cancellationToken) => client.TryCreateConnectionAsync(serviceName, callbackTarget: null, cancellationToken: cancellationToken);
public static Task <bool> TryRunRemoteAsync( this RemoteHostClient client, string serviceName, Solution solution, string targetName, object argument, CancellationToken cancellationToken) => TryRunRemoteAsync(client, serviceName, solution, targetName, new object[] { argument }, cancellationToken);
public static Task <KeepAliveSession> TryCreateCodeAnalysisKeepAliveSessionAsync( this RemoteHostClient client, object callbackTarget, CancellationToken cancellationToken) => client.TryCreateKeepAliveSessionAsync(WellKnownServiceHubServices.CodeAnalysisService, callbackTarget, cancellationToken);