JsonRpc.InvokeCoreAsync Method

Definition

Overloads

InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, CancellationToken)

Invokes the specified RPC method.

InvokeCoreAsync<TResult>(Nullable<Int32>, String, IReadOnlyList<Object>, CancellationToken)

Invokes the specified RPC method

InvokeCoreAsync<TResult>(Nullable<Int64>, String, IReadOnlyList<Object>, CancellationToken)
Obsolete.

Invokes the specified RPC method.

InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, CancellationToken, Boolean)

Invokes the specified RPC method.

InvokeCoreAsync<TResult>(Nullable<Int32>, String, IReadOnlyList<Object>, CancellationToken, Boolean)

Invokes the specified RPC method

InvokeCoreAsync<TResult>(Nullable<Int64>, String, IReadOnlyList<Object>, CancellationToken, Boolean)
Obsolete.

Invokes a given method on a JSON-RPC server.

InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, IReadOnlyList<Type>, IReadOnlyDictionary<String,Type>, CancellationToken, Boolean)

Invokes a given method on a JSON-RPC server.

InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, CancellationToken)

Invokes the specified RPC method.

protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (StreamJsonRpc.RequestId id, string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Threading.CancellationToken cancellationToken);
member this.InvokeCoreAsync : StreamJsonRpc.RequestId * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Protected Function InvokeCoreAsync(Of TResult) (id As RequestId, targetName As String, arguments As IReadOnlyList(Of Object), cancellationToken As CancellationToken) As Task(Of TResult)

Type Parameters

TResult

RPC method return type.

Parameters

id
RequestId

An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.

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 whose result is the deserialized response from the JSON-RPC server.

Applies to

InvokeCoreAsync<TResult>(Nullable<Int32>, String, IReadOnlyList<Object>, CancellationToken)

Invokes the specified RPC method

protected virtual System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (int? id, string targetName, System.Collections.Generic.IReadOnlyList<object> arguments, System.Threading.CancellationToken cancellationToken);
abstract member InvokeCoreAsync : Nullable<int> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
override this.InvokeCoreAsync : Nullable<int> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Protected Overridable Function InvokeCoreAsync(Of TResult) (id As Nullable(Of Integer), targetName As String, arguments As IReadOnlyList(Of Object), cancellationToken As CancellationToken) As Task(Of TResult)

Type Parameters

TResult

RPC method return type

Parameters

id
Nullable<Int32>

An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.

targetName
String

Name of the method to invoke.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. 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 whose result is the deserialized response from the JSON-RPC server.

Applies to

InvokeCoreAsync<TResult>(Nullable<Int64>, String, IReadOnlyList<Object>, CancellationToken)

Caution

Use the InvokeCoreAsync(RequestId, ...) overload instead.

Invokes the specified RPC method.

protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (long? id, string targetName, System.Collections.Generic.IReadOnlyList<object> arguments, System.Threading.CancellationToken cancellationToken);
[System.Obsolete("Use the InvokeCoreAsync(RequestId, ...) overload instead.")]
protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (long? id, string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Threading.CancellationToken cancellationToken);
member this.InvokeCoreAsync : Nullable<int64> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
[<System.Obsolete("Use the InvokeCoreAsync(RequestId, ...) overload instead.")>]
member this.InvokeCoreAsync : Nullable<int64> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Protected Function InvokeCoreAsync(Of TResult) (id As Nullable(Of Long), targetName As String, arguments As IReadOnlyList(Of Object), cancellationToken As CancellationToken) As Task(Of TResult)

Type Parameters

TResult

RPC method return type.

Parameters

id
Nullable<Int64>

An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.

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 whose result is the deserialized response from the JSON-RPC server.

Attributes

Applies to

InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, CancellationToken, Boolean)

Invokes the specified RPC method.

protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (StreamJsonRpc.RequestId id, string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Threading.CancellationToken cancellationToken, bool isParameterObject);
member this.InvokeCoreAsync : StreamJsonRpc.RequestId * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<'Result>
Protected Function InvokeCoreAsync(Of TResult) (id As RequestId, targetName As String, arguments As IReadOnlyList(Of Object), cancellationToken As CancellationToken, isParameterObject As Boolean) As Task(Of TResult)

Type Parameters

TResult

RPC method return type.

Parameters

id
RequestId

An identifier established by the Client. If the default value is given, it is assumed to be a notification.

targetName
String

Name of the method to invoke.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. If null, no arguments are passed.

cancellationToken
CancellationToken

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

isParameterObject
Boolean

Value which indicates if parameter should be passed as an object.

Returns

Task<TResult>

A task whose result is the deserialized response from the JSON-RPC server.

Applies to

InvokeCoreAsync<TResult>(Nullable<Int32>, String, IReadOnlyList<Object>, CancellationToken, Boolean)

Invokes the specified RPC method

protected virtual System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (int? id, string targetName, System.Collections.Generic.IReadOnlyList<object> arguments, System.Threading.CancellationToken cancellationToken, bool isParameterObject);
abstract member InvokeCoreAsync : Nullable<int> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<'Result>
override this.InvokeCoreAsync : Nullable<int> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<'Result>
Protected Overridable Function InvokeCoreAsync(Of TResult) (id As Nullable(Of Integer), targetName As String, arguments As IReadOnlyList(Of Object), cancellationToken As CancellationToken, isParameterObject As Boolean) As Task(Of TResult)

Type Parameters

TResult

RPC method return type

Parameters

id
Nullable<Int32>

An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.

targetName
String

Name of the method to invoke.

arguments
IReadOnlyList<Object>

Arguments to pass to the invoked method. If null, no arguments are passed.

cancellationToken
CancellationToken

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

isParameterObject
Boolean

Value which indicates if parameter should be passed as an object.

Returns

Task<TResult>

A task whose result is the deserialized response from the JSON-RPC server.

Applies to

InvokeCoreAsync<TResult>(Nullable<Int64>, String, IReadOnlyList<Object>, CancellationToken, Boolean)

Caution

Use the InvokeCoreAsync(RequestId, ...) overload instead.

Invokes a given method on a JSON-RPC server.

protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (long? id, string targetName, System.Collections.Generic.IReadOnlyList<object> arguments, System.Threading.CancellationToken cancellationToken, bool isParameterObject);
[System.Obsolete("Use the InvokeCoreAsync(RequestId, ...) overload instead.")]
protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (long? id, string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Threading.CancellationToken cancellationToken, bool isParameterObject);
member this.InvokeCoreAsync : Nullable<int64> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<'Result>
[<System.Obsolete("Use the InvokeCoreAsync(RequestId, ...) overload instead.")>]
member this.InvokeCoreAsync : Nullable<int64> * string * System.Collections.Generic.IReadOnlyList<obj> * System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<'Result>
Protected Function InvokeCoreAsync(Of TResult) (id As Nullable(Of Long), targetName As String, arguments As IReadOnlyList(Of Object), cancellationToken As CancellationToken, isParameterObject As Boolean) As Task(Of TResult)

Type Parameters

TResult

RPC method return type.

Parameters

id
Nullable<Int64>

An identifier established by the Client. If the default value is given, it is assumed to be a notification.

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.

isParameterObject
Boolean

Value which indicates if parameter should be passed as an object.

Returns

Task<TResult>

A task whose result is the deserialized response from the JSON-RPC server.

Attributes

Applies to

InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, IReadOnlyList<Type>, IReadOnlyDictionary<String,Type>, CancellationToken, Boolean)

Invokes a given method on a JSON-RPC server.

protected System.Threading.Tasks.Task<TResult> InvokeCoreAsync<TResult> (StreamJsonRpc.RequestId id, string targetName, System.Collections.Generic.IReadOnlyList<object?>? arguments, System.Collections.Generic.IReadOnlyList<Type>? positionalArgumentDeclaredTypes, System.Collections.Generic.IReadOnlyDictionary<string,Type>? namedArgumentDeclaredTypes, System.Threading.CancellationToken cancellationToken, bool isParameterObject);
member this.InvokeCoreAsync : StreamJsonRpc.RequestId * string * System.Collections.Generic.IReadOnlyList<obj> * System.Collections.Generic.IReadOnlyList<Type> * System.Collections.Generic.IReadOnlyDictionary<string, Type> * System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<'Result>
Protected Function InvokeCoreAsync(Of TResult) (id As RequestId, targetName As String, arguments As IReadOnlyList(Of Object), positionalArgumentDeclaredTypes As IReadOnlyList(Of Type), namedArgumentDeclaredTypes As IReadOnlyDictionary(Of String, Type), cancellationToken As CancellationToken, isParameterObject As Boolean) As Task(Of TResult)

Type Parameters

TResult

RPC method return type.

Parameters

id
RequestId

An identifier established by the Client. If the default value is given, it is assumed to be a notification.

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.

positionalArgumentDeclaredTypes
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.

namedArgumentDeclaredTypes
IReadOnlyDictionary<String,Type>

A dictionary of Type objects that describe how each entry in the IReadOnlyDictionary<TKey,TValue> provided in the only element of arguments is expected by the server to be typed. If specified, this must have exactly the same set of keys as the dictionary contained in the first element of arguments, and contain no null values.

cancellationToken
CancellationToken

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

isParameterObject
Boolean

Value which indicates if parameter should be passed as an object.

Returns

Task<TResult>

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

Exceptions

Thrown after cancellationToken is canceled. If the request has already been transmitted, the exception is only thrown after the server has received the cancellation notification and responded to it. If the server completes the request instead of cancelling, this exception will not be thrown. When the connection drops before receiving a response, this exception is thrown if cancellationToken has been canceled.

A common base class for a variety of RPC exceptions that may be thrown. Some common derived types are listed individually.

Thrown when an error is returned from the server in consequence of executing the requested method.

Thrown when the server reports that no matching method was found to invoke.

If targetName is null.

Thrown when targetName is empty.

If this instance of JsonRpc has already been disposed prior to this call.

Thrown when the connection is terminated (by either side) before the request or while the request is in progress, unless cancellationToken is already signaled.

Any exception thrown by the IJsonRpcMessageFormatter (typically due to serialization failures). When using JsonMessageFormatter this should be Newtonsoft.Json.JsonSerializationException. When using MessagePackFormatter this should be MessagePack.MessagePackSerializationException.

Applies to