Compartilhar via


IVsTask Interface

Provides methods that interact with a task, such as starting it, cancelling it, or appending continuations.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assemblies:   Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)
  Microsoft.VisualStudio.Shell.Interop.11.0 (in Microsoft.VisualStudio.Shell.Interop.11.0.dll)
  Microsoft.VisualStudio.Shell.Immutable.11.0 (in Microsoft.VisualStudio.Shell.Immutable.11.0.dll)

Syntax

'Declaration
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
<GuidAttribute("0B98EAB8-00BB-45D0-AE2F-3DE35CD68235")> _
Public Interface IVsTask
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[GuidAttribute("0B98EAB8-00BB-45D0-AE2F-3DE35CD68235")]
public interface IVsTask
[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown)]
[GuidAttribute(L"0B98EAB8-00BB-45D0-AE2F-3DE35CD68235")]
public interface class IVsTask
[<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)>]
[<GuidAttribute("0B98EAB8-00BB-45D0-AE2F-3DE35CD68235")>]
type IVsTask =  interface end
public interface IVsTask

The IVsTask type exposes the following members.

Properties

  Name Description
Public property AsyncState Gets the asynchronous state object that was given when the task was created.
Public property Description Gets or sets the description for the text that is displayed for component diagnostics.
Public property IsCanceled Gets whether the task group is cancelled. If true, the task group is cancelled.
Public property IsCompleted Gets whether the task result is available. If true, the task result is available. If false, a GetResult call is blocked until the task is completed.
Public property IsFaulted Gets whether the task completed with an exception. If true, an exception occurred.

Top

Methods

  Name Description
Public method _VtblGap1_2
Public method _VtblGap2_1
Public method AbortIfCanceled Aborts the task if the task has been cancelled. Use this method to return from a cancelled task.
Public method Cancel Cancels the task group. An antecedent task and all of its children share the same cancellation token, so cancelling any of the tasks cancels the whole task group.
Public method ContinueWith Appends the provided action to this task to be run after the task is run to completion. The action is invoked on the context provided.
Public method ContinueWithEx Appends the provided action (using the specified options) to this task to be run after the task is run to completion. The action is invoked on the context provided.
Public method GetResult Waits for the task to complete (not including any continuations) and returns the result set by the task. If the task returns an error code or an exception, this method returns the same error code.
Public method Start Starts the task.
Public method Wait Waits for the task to complete (not including any continuations). If the task returns an error code or an exception, this method returns the same error code.
Public method WaitEx Waits for the task to complete (not including any continuations). You can either specify a timeout (or INFINITE) or set the option to abort on task cancellation.

Top

Extension Methods

  Name Description
Public Extension Method ApplyCancellationToken Signals a Visual Studio task to cancel operations as soon as possible when the specified token is canceled. (Defined by VsTaskLibraryHelper.)
Public Extension Method ContinueWith(VsTaskRunContext, IVsTaskBody) Overloaded. Appends to this task the provided action, to be run after the task is run to completion. The action is invoked on the provided context. Overrides ContinueWith. (Defined by VsTaskLibraryHelper.)
Public Extension Method ContinueWith(VsTaskRunContext, VsTaskContinuationOptions, IVsTaskBody, Object) Overloaded. Uses the specified options to append to this task the provided action, to be run after the task is run to completion. The action is invoked on the provided context. Overrides ContinueWithEx. (Defined by VsTaskLibraryHelper.)
Public Extension Method GetAwaiter Internal use only. Gets the task to be used for scheduling continuations. (Defined by VsTaskLibraryHelper.)
Public Extension Method ResumeWith Extension method for task awaiter to support awaits with a specific context. (Defined by VsTaskLibraryHelper.)
Public Extension Method Wait(Int32) Overloaded. Waits for the task to complete (not including any continuations). Override for WaitEx with default options. (Defined by VsTaskLibraryHelper.)
Public Extension Method Wait(Int32, VsTaskWaitOptions) Overloaded. Waits for the task to complete (not including any continuations). Override for WaitEx to use correct enumeration types. (Defined by VsTaskLibraryHelper.)

Top

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace