VsTaskLibraryHelper::RunAsyncAsVsTask<T> Method (JoinableTaskFactory^, VsTaskRunContext, Func<CancellationToken, Task<T>^>^)
Visual Studio 2015
Creates an IVsTask to track a cancelable async operation.
Assembly: Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)
public: generic<typename T> [ExtensionAttribute] static IVsTask^ RunAsyncAsVsTask( JoinableTaskFactory^ joinableTaskFactory, VsTaskRunContext priority, Func<CancellationToken, Task<T>^>^ asyncMethod )
Parameters
- joinableTaskFactory
-
Type:
Microsoft.VisualStudio.Threading::JoinableTaskFactory^
The factory to use for creating the task.
- priority
- Type: Microsoft.VisualStudio.Shell::VsTaskRunContext
- asyncMethod
- Type: System::Func<CancellationToken, Task<T>^>^
Return Value
Type: Microsoft.VisualStudio.Shell.Interop::IVsTask^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 async 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.
Show: