다음을 통해 공유


IVsTask Interface

Definition

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

public interface class IVsTask
public interface class IVsTask
__interface IVsTask
public interface IVsTask
[System.Runtime.InteropServices.Guid("0B98EAB8-00BB-45D0-AE2F-3DE35CD68235")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsTask
type IVsTask = interface
[<System.Runtime.InteropServices.Guid("0B98EAB8-00BB-45D0-AE2F-3DE35CD68235")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsTask = interface
Public Interface IVsTask
Derived
Attributes

Remarks

This interface is safe to access from any thread.

Properties

AsyncState

Gets the asynchronous state object that was given when the task was created.

Description

Gets or sets the description for the text that is displayed for component diagnostics.

IsCanceled

Gets whether the task group is cancelled. If true, the task group is cancelled.

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.

IsFaulted

Gets whether the task completed with an exception. If true, an exception occurred.

Methods

AbortIfCanceled()

Aborts the task if the task has been cancelled. Use this method to return from a cancelled task.

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.

ContinueWith(UInt32, IVsTaskBody)

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.

ContinueWithEx(UInt32, UInt32, IVsTaskBody, Object)

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.

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.

Start()

Starts the task.

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.

WaitEx(Int32, UInt32)

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.

Extension Methods

ApplyCancellationToken(IVsTask, CancellationToken)

Signals a VS Task to abort operations as soon as possible when the specified token is canceled.

CancelOnShutdown(IVsTask, AsyncPackage)

Ensures that task will be canceled when package is disposed. The package's Dispose method will not return until task completes.

CancelWhenCancellationRequested(IVsTask, JoinableTaskFactory, CancellationToken)

Ensures that task will be canceled when cancellation is requested for cancellationToken.

ContinueWith(IVsTask, VsTaskRunContext, IVsTaskBody)

Override for IVsTask.ContinueWith to use proper enum types.

ContinueWith(IVsTask, VsTaskRunContext, VsTaskContinuationOptions, IVsTaskBody, Object)

Override for IVsTask.ContinueWithEx to use proper enum types.

GetAwaiter(IVsTask)

Extension method for IVsTask to support await syntax in managed code.

ResumeWith(IVsTask, VsTaskRunContext)

Extension method for task awatier to support awaits with a specific context.

Wait(IVsTask, Int32, VsTaskWaitOptions)

Override for IvsTask.WaitEx to use proper enum types.

Wait(IVsTask, Int32)

Override for IvsTask.WaitEx with default options.

Applies to