Κοινή χρήση μέσω


Task class - internal members

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This article describes the internal members of the System.Threading.Tasks.Task class that help you implement a custom debugger. For general information about this class, see the Task reference article.

Namespace: System.Threading.Tasks

Assembly: mscorlib (in mscorlib.dll)

Because you can't access these internal members from the .NET Framework, the following syntax is provided in Common Intermediate Language (CIL).

Syntax

.class public auto ansi System.Threading.Tasks.Task
       extends System.Object
       implements System.Threading.IThreadPoolWorkItem,
                  System.IAsyncResult,
                  System.IDisposable,
                  System.Threading.ICancelableOperation

Members

Methods

Name Description
SetNotificationForWaitCompletion Method Sets or clears the TASK_STATE_WAIT_COMPLETION_NOTIFICATION state bit.
NotifyDebuggerOfWaitCompletion Method Placeholder method used as a breakpoint target by the debugger.

Fields

Name Description
m_action The delegate that represents the code to execute in the Task object.
m_contingentProperties Stores additional properties of the Task object.
m_parent The backing field for the System.Threading.Tasks.Task parent property.
m_stateFlags Stores information about the current state of the Task object.
m_stateObject An object that represents data that will be used by the action.
m_taskId The backing field for the System.Threading.Tasks.Task.Id property.
s_taskIdCounter The next available identifier for a Task object.
TASK_STATE_CANCELED Indicates that the task canceled before it reached the running state, or that the task confirmed its cancellation and completed without exception.
TASK_STATE_EXECUTED Indicates that the task is running.
TASK_STATE_FAULTED Indicates that the task completed because of an unhandled exception.
TASK_STATE_RAN_TO_COMPLETION Indicates that the task completed execution successfully.
TASK_STATE_WAITING_ON_CHILDREN Indicates that the task finished executing its delegate and is implicitly waiting for attached child tasks to finish.

Remarks

The following internal methods are useful to a debugger engine because they mark the entrance to Task code execution:

  • Execute

  • ExecuteEntry

  • ExecuteWithThreadLocal

  • Finish

  • InnerInvoke

  • InternalWait

See also