共用方式為


IAsyncServiceProvider3 Interface

Definition

Provides a mechanism for retrieving proffered services asynchronously. This is the async equivalent of IServiceProvider and should be used in asynchronous contexts to avoid blocking calling threads.

public interface IAsyncServiceProvider3 : Microsoft.VisualStudio.Shell.IAsyncServiceProvider2
type IAsyncServiceProvider3 = interface
    interface IAsyncServiceProvider2
    interface IAsyncServiceProvider
Public Interface IAsyncServiceProvider3
Implements IAsyncServiceProvider2
Derived
Implements

Remarks

This interface is safe to access from any thread.

Prefer this interface and ServiceExtensions over using IAsyncServiceProvider and IAsyncServiceProvider2 directly to avoid unexpected blocking RPC calls when casting the resulting service to a specific interface. The former also provide more consistent throwing behavior.

Methods

GetServiceAsync(Type, Boolean)

Retrieves a proffered service asynchronously, specifying a hint whether to throw an exception if it could not be retrieved. It does not, however, guarantee exceptions will be thrown for all failure cases.

(Inherited from IAsyncServiceProvider2)
GetServiceAsync(Type)

Retrieves a proffered service asynchronously.

(Inherited from IAsyncServiceProvider)
GetServiceAsync<TService,TInterface>(Boolean, CancellationToken)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

Extension Methods

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, Boolean, CancellationToken)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, Boolean)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, CancellationToken)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

Applies to