AsyncPackage.GetServiceAsync Method

Definition

Overloads

GetServiceAsync(Type)

Retrieves an async service.

GetServiceAsync(Type, Boolean)

Retrieves an async services but allows the caller to hint that exceptions may not have to be swallowed. It does not guarantee exceptions will be thrown however for failure cases.

GetServiceAsync(Type)

Retrieves an async service.

public:
 virtual System::Threading::Tasks::Task<System::Object ^> ^ GetServiceAsync(Type ^ serviceType);
public System.Threading.Tasks.Task<object> GetServiceAsync (Type serviceType);
abstract member GetServiceAsync : Type -> System.Threading.Tasks.Task<obj>
override this.GetServiceAsync : Type -> System.Threading.Tasks.Task<obj>
Public Function GetServiceAsync (serviceType As Type) As Task(Of Object)

Parameters

serviceType
Type

The type representing the registered service type to retrieve.

Returns

A task representing the service retrieval whose result is the service, or null if the retrieval failed.

Implements

Applies to

GetServiceAsync(Type, Boolean)

Retrieves an async services but allows the caller to hint that exceptions may not have to be swallowed. It does not guarantee exceptions will be thrown however for failure cases.

public:
 virtual System::Threading::Tasks::Task<System::Object ^> ^ GetServiceAsync(Type ^ serviceType, bool swallowExceptions);
public System.Threading.Tasks.Task<object> GetServiceAsync (Type serviceType, bool swallowExceptions);
abstract member GetServiceAsync : Type * bool -> System.Threading.Tasks.Task<obj>
override this.GetServiceAsync : Type * bool -> System.Threading.Tasks.Task<obj>
Public Function GetServiceAsync (serviceType As Type, swallowExceptions As Boolean) As Task(Of Object)

Parameters

serviceType
Type

Service to get

swallowExceptions
Boolean

When this parameter is true GetServiceAsync will swallow exceptions thrown during the GetServiceAsync call and return null. When this is false exceptions thrown during the get service call may be thrown out of the method. A setting of false does not guarantee exceptions will be thrown for all services failures, or all service types

Returns

A task representing the service retrieval whose result is the service, or null if the retrieval failed.

Implements

Applies to