JsonRpc.InvokeAsync 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
InvokeAsync(String, Object[]) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync(String, Object) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync<TResult>(String, Object) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync<TResult>(String, Object[]) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync(String, Object[])
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task InvokeAsync (string targetName, params object[] arguments);
public System.Threading.Tasks.Task InvokeAsync (string targetName, params object?[]? arguments);
member this.InvokeAsync : string * obj[] -> System.Threading.Tasks.Task
Public Function InvokeAsync (targetName As String, ParamArray arguments As Object()) As Task
Parameters
- targetName
- String
Name of the method to invoke. Must not be null or empty.
- arguments
- Object[]
Arguments to pass to the invoked method. They must be serializable using the selected IJsonRpcMessageFormatter. If null
, no arguments are passed.
Returns
A task that completes when the server method executes.
Exceptions
Result task fails with this exception if the communication channel ends before the server indicates completion of the method.
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
InvokeAsync(String, Object)
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task InvokeAsync (string targetName, object argument);
public System.Threading.Tasks.Task InvokeAsync (string targetName, object? argument);
member this.InvokeAsync : string * obj -> System.Threading.Tasks.Task
Public Function InvokeAsync (targetName As String, argument As Object) As Task
Parameters
- targetName
- String
Name of the method to invoke. Must not be null or empty.
- argument
- Object
A single method argument, must be serializable using the selected IJsonRpcMessageFormatter.
Returns
A task that completes when the server method executes.
Exceptions
Result task fails with this exception if the communication channel ends before the server indicates completion of the method.
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
InvokeAsync<TResult>(String, Object)
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task<TResult> InvokeAsync<TResult> (string targetName, object argument);
public System.Threading.Tasks.Task<TResult> InvokeAsync<TResult> (string targetName, object? argument);
member this.InvokeAsync : string * obj -> System.Threading.Tasks.Task<'Result>
Public Function InvokeAsync(Of TResult) (targetName As String, argument As Object) 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
A single method argument, must be serializable using the selected IJsonRpcMessageFormatter.
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
InvokeAsync<TResult>(String, Object[])
Invokes a given method on a JSON-RPC server.
public System.Threading.Tasks.Task<TResult> InvokeAsync<TResult> (string targetName, params object[] arguments);
public System.Threading.Tasks.Task<TResult> InvokeAsync<TResult> (string targetName, params object?[]? arguments);
member this.InvokeAsync : string * obj[] -> System.Threading.Tasks.Task<'Result>
Public Function InvokeAsync(Of TResult) (targetName As String, ParamArray arguments As Object()) 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
- Object[]
Arguments to pass to the invoked method. They must be serializable using the selected IJsonRpcMessageFormatter. If null
, no arguments are passed.
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.