Compartilhar via


IExportedBrokeredService.InitializeAsync(CancellationToken) Method

Definition

Initializes the brokered service before returning the new instance to its client.

[StreamJsonRpc.JsonRpcIgnore]
public System.Threading.Tasks.Task InitializeAsync (System.Threading.CancellationToken cancellationToken);
[<StreamJsonRpc.JsonRpcIgnore>]
abstract member InitializeAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function InitializeAsync (cancellationToken As CancellationToken) As Task

Parameters

cancellationToken
CancellationToken

A cancellation token.

Returns

A task that completes with initialization.

Attributes
StreamJsonRpc.JsonRpcIgnoreAttribute

Remarks

This method offers the brokered service an optional opportunity to do async initialization, similar to what BrokeredServiceFactory would have allowed for when proffering a non-MEF brokered service with Proffer(ServiceRpcDescriptor, BrokeredServiceFactory). Empty methods may simply return CompletedTask.

Throwing from this method will lead to the client experiencing a ServiceActivationFailedException with the exception thrown from here preserved as an inner exception.

Applies to