VsTaskLibraryHelper::RunAsync<T> Method (JoinableTaskFactory^, VsTaskRunContext, Func<Task<T>^>^)
Wraps the invocation of an async method so that it may execute asynchronously, but may potentially be synchronously completed (waited on) in the future.
Assembly: Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)
public: generic<typename T> [ExtensionAttribute] static JoinableTask<T>^ RunAsync( JoinableTaskFactory^ joinableTaskFactory, VsTaskRunContext priority, Func<Task<T>^>^ asyncMethod )
Parameters
- joinableTaskFactory
-
Type:
Microsoft.VisualStudio.Threading::JoinableTaskFactory^
The factory to use for creating the task.
- priority
-
Type:
Microsoft.VisualStudio.Shell::VsTaskRunContext
he priority with which to schedule any work on the UI thread, when and if SwitchToMainThreadAsync is called.
- asyncMethod
-
Type:
System::Func<Task<T>^>^
The method that, when executed, will begin the async operation.
Return Value
Type: Microsoft.VisualStudio.Threading::JoinableTask<T>^An object that tracks the completion of the async operation, and allows for later synchronous blocking of the main thread for completion if necessary.
Type Parameters
- T
The type of value returned by the asynchronous operation.
Exceptions thrown by the delegate are captured by the returned JoinableTask. Note that the asyncMethod delegate begins its execution on the caller's thread, and must explicitly call SwitchToMainThreadAsync if the main thread is desired.