IVsService<T>.GetValueOrNullAsync(CancellationToken) Method

Definition

Gets an instance of the T service.

public System.Threading.Tasks.Task<T?> GetValueOrNullAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member GetValueOrNullAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T (requires 'T : null)>
Public Function GetValueOrNullAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

Parameters

cancellationToken
CancellationToken

A cancellation token.

Returns

Task<T>

An instance of the service if available; otherwise null.

Exceptions

Throw when cancellationToken is canceled before the request can be satisfied.

Remarks

This method will not throw exceptions for missing services or faulted service factories. It simply returns null for any failure.

Applies to