IVsService<T>.GetValueOrNullAsync(CancellationToken) 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.
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.