JsonRpc.InvokeWithParameterObjectAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
InvokeWithParameterObjectAsync(String, Object, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync(String, Object, IReadOnlyDictionary<String,Type>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync<TResult>(String, Object, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync<TResult>(String, Object, IReadOnlyDictionary<String,Type>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync(String, Object, CancellationToken)
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task InvokeWithParameterObjectAsync (string targetName, object argument = default, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task InvokeWithParameterObjectAsync (string targetName, object? argument = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeWithParameterObjectAsync : string * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function InvokeWithParameterObjectAsync (targetName As String, Optional argument As Object = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- targetName
- String
Name of the method to invoke. Must not be null or empty.
- argument
- Object
An object whose properties match the names of parameters on the target method. Must be serializable using the selected IJsonRpcMessageFormatter.
- 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 and returns the result.
Exceptions
Result task fails with this exception if the communication channel ends before the result gets back from the server.
Result task fails with this exception if the server method throws an exception.
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
InvokeWithParameterObjectAsync(String, Object, IReadOnlyDictionary<String,Type>, CancellationToken)
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task InvokeWithParameterObjectAsync (string targetName, object? argument, System.Collections.Generic.IReadOnlyDictionary<string,Type>? argumentDeclaredTypes, System.Threading.CancellationToken cancellationToken);
member this.InvokeWithParameterObjectAsync : string * obj * System.Collections.Generic.IReadOnlyDictionary<string, Type> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function InvokeWithParameterObjectAsync (targetName As String, argument As Object, argumentDeclaredTypes As IReadOnlyDictionary(Of String, Type), cancellationToken As CancellationToken) As Task
Parameters
- targetName
- String
Name of the method to invoke. Must not be null or empty.
- argument
- Object
An object whose properties match the names of parameters on the target method. Must be serializable using the selected IJsonRpcMessageFormatter.
- argumentDeclaredTypes
- IReadOnlyDictionary<String,Type>
A dictionary of Type objects that describe how each entry in the IReadOnlyDictionary<TKey,TValue> provided in argument
is expected by the server to be typed.
If specified, this must have exactly the same set of keys as argument
and contain no null
values.
- 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
InvokeWithParameterObjectAsync<TResult>(String, Object, CancellationToken)
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task<TResult> InvokeWithParameterObjectAsync<TResult> (string targetName, object argument = default, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task<TResult> InvokeWithParameterObjectAsync<TResult> (string targetName, object? argument = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeWithParameterObjectAsync : string * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Public Function InvokeWithParameterObjectAsync(Of TResult) (targetName As String, Optional argument As 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.
- argument
- Object
An object whose properties match the names of parameters on the target method. Must be serializable using the selected IJsonRpcMessageFormatter.
- 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 and returns the result.
Exceptions
Result task fails with this exception if the communication channel ends before the result gets back from the server.
Result task fails with this exception if the server method throws an exception.
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
InvokeWithParameterObjectAsync<TResult>(String, Object, IReadOnlyDictionary<String,Type>, CancellationToken)
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task<TResult> InvokeWithParameterObjectAsync<TResult> (string targetName, object? argument, System.Collections.Generic.IReadOnlyDictionary<string,Type>? argumentDeclaredTypes, System.Threading.CancellationToken cancellationToken);
member this.InvokeWithParameterObjectAsync : string * obj * System.Collections.Generic.IReadOnlyDictionary<string, Type> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Public Function InvokeWithParameterObjectAsync(Of TResult) (targetName As String, argument As Object, argumentDeclaredTypes As IReadOnlyDictionary(Of String, 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.
- argument
- Object
An object whose properties match the names of parameters on the target method. Must be serializable using the selected IJsonRpcMessageFormatter.
- argumentDeclaredTypes
- IReadOnlyDictionary<String,Type>
A dictionary of Type objects that describe how each entry in the IReadOnlyDictionary<TKey,TValue> provided in argument
is expected by the server to be typed.
If specified, this must have exactly the same set of keys as argument
and contain no null
values.
- 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.