JsonRpc.InvokeWithCancellationAsync Method

Definition

Overloads

InvokeWithCancellationAsync(String, IReadOnlyList<Object>, IReadOnlyList<Type>, CancellationToken)

Invokes a given method on a JSON-RPC server.

InvokeWithCancellationAsync(String, IReadOnlyList<Object>, CancellationToken)

Invokes a given method on a JSON-RPC server.

InvokeWithCancellationAsync<TResult>(String, IReadOnlyList<Object>, CancellationToken)

Invokes a given method on a JSON-RPC server.

InvokeWithCancellationAsync<TResult>(String, IReadOnlyList<Object>, IReadOnlyList<Type>, CancellationToken)

Invokes a given method on a JSON-RPC server.

InvokeWithCancellationAsync(String, IReadOnlyList<Object>, IReadOnlyList<Type>, CancellationToken)

Invokes a given method on a JSON-RPC server.

public System.Threading.Tasks.Task InvokeWithCancellationAsync (string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Collections.Generic.IReadOnlyList<Type> argumentDeclaredTypes, System.Threading.CancellationToken cancellationToken);
member this.InvokeWithCancellationAsync : string * System.Collections.Generic.IReadOnlyList<obj> * System.Collections.Generic.IReadOnlyList<Type> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function InvokeWithCancellationAsync (targetName As String, arguments As IReadOnlyList(Of Object), argumentDeclaredTypes As IReadOnlyList(Of Type), cancellationToken As CancellationToken) As Task

Parameters

targetName
String

Name of the method to invoke. Must not be null or empty.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. They must be serializable using the selected IJsonRpcMessageFormatter. If null, no arguments are passed.

argumentDeclaredTypes
IReadOnlyList<Type>
cancellationToken
CancellationToken

The token whose cancellation should signal the server to stop processing this request.

Returns

A task that completes with the response from the JSON-RPC server.

Applies to

InvokeWithCancellationAsync(String, IReadOnlyList<Object>, CancellationToken)

Invokes a given method on a JSON-RPC server.

public System.Threading.Tasks.Task InvokeWithCancellationAsync (string targetName, System.Collections.Generic.IReadOnlyList<object> arguments = default, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task InvokeWithCancellationAsync (string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeWithCancellationAsync : string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function InvokeWithCancellationAsync (targetName As String, Optional arguments As IReadOnlyList(Of Object) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

targetName
String

Name of the method to invoke. Must not be null or empty.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. They must be serializable using the selected IJsonRpcMessageFormatter. If null, no arguments are passed.

cancellationToken
CancellationToken

The token whose cancellation should signal the server to stop processing this request.

Returns

A task that completes when the server method executes.

Exceptions

Result task fails with this exception if the communication channel ends before the result gets back from the server or in response to the cancellationToken being canceled.

Result task fails with this exception if the server method throws an exception, which may occur in response to the cancellationToken being canceled.

Result task fails with this exception if the targetName method has not been registered on the server.

If targetName is null.

If this instance of JsonRpc has been disposed.

Result task fails with this exception if the server has no target object.

Applies to

InvokeWithCancellationAsync<TResult>(String, IReadOnlyList<Object>, CancellationToken)

Invokes a given method on a JSON-RPC server.

public System.Threading.Tasks.Task<TResult> InvokeWithCancellationAsync<TResult> (string targetName, System.Collections.Generic.IReadOnlyList<object> arguments = default, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task<TResult> InvokeWithCancellationAsync<TResult> (string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeWithCancellationAsync : string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Public Function InvokeWithCancellationAsync(Of TResult) (targetName As String, Optional arguments As IReadOnlyList(Of Object) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TResult)

Type Parameters

TResult

Type of the method result.

Parameters

targetName
String

Name of the method to invoke. Must not be null or empty.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. They must be serializable using the selected IJsonRpcMessageFormatter. If null, no arguments are passed.

cancellationToken
CancellationToken

The token whose cancellation should signal the server to stop processing this request.

Returns

Task<TResult>

A task that completes when the server method executes and returns the result.

Exceptions

Result task fails with this exception if the communication channel ends before the result gets back from the server or in response to the cancellationToken being canceled.

Result task fails with this exception if the server method throws an exception, which may occur in response to the cancellationToken being canceled.

Result task fails with this exception if the targetName method has not been registered on the server.

If targetName is null.

If this instance of JsonRpc has been disposed.

Result task fails with this exception if the server has no target object.

Applies to

InvokeWithCancellationAsync<TResult>(String, IReadOnlyList<Object>, IReadOnlyList<Type>, CancellationToken)

Invokes a given method on a JSON-RPC server.

public System.Threading.Tasks.Task<TResult> InvokeWithCancellationAsync<TResult> (string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Collections.Generic.IReadOnlyList<Type>? argumentDeclaredTypes, System.Threading.CancellationToken cancellationToken);
member this.InvokeWithCancellationAsync : string * System.Collections.Generic.IReadOnlyList<obj> * System.Collections.Generic.IReadOnlyList<Type> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Public Function InvokeWithCancellationAsync(Of TResult) (targetName As String, arguments As IReadOnlyList(Of Object), argumentDeclaredTypes As IReadOnlyList(Of Type), cancellationToken As CancellationToken) As Task(Of TResult)

Type Parameters

TResult

Type of the method result.

Parameters

targetName
String

Name of the method to invoke. Must not be null or empty.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. They must be serializable using the selected IJsonRpcMessageFormatter. If null, no arguments are passed.

argumentDeclaredTypes
IReadOnlyList<Type>

A list of Type objects that describe how each element in arguments is expected by the server to be typed. If specified, this must have exactly the same length as arguments and contain no null elements. This value is ignored when isParameterObject is true.

cancellationToken
CancellationToken

The token whose cancellation should signal the server to stop processing this request.

Returns

Task<TResult>

A task that completes when the server method executes and returns the result.

Applies to