Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Task Class - Internal Members


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Task Class - Internal Members.

This topic 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 topic.

Namespace: System.Threading.Tasks

Assembly: mscorlib (in mscorlib.dll)

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

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


SetNotificationForWaitCompletion MethodSets or clears the TASK_STATE_WAIT_COMPLETION_NOTIFICATION state bit.
NotifyDebuggerOfWaitCompletion MethodPlaceholder method used as a breakpoint target by the debugger.


m_actionThe delegate that represents the code to execute in the Task object.
m_contingentPropertiesStores additional properties of the Task object.
m_parentThe backing field for the System.Threading.Tasks.Task parent property.
m_stateFlagsStores information about the current state of the Task object.
m_stateObjectAn object that represents data that will be used by the action.
m_taskIdThe backing field for the Task.Id property.
s_taskIdCounterThe next available identifier for a Task object.
TASK_STATE_CANCELEDIndicates that the task was canceled before it reached the running state, or that the task acknowledged its cancellation and completed without exception.
TASK_STATE_EXECUTEDIndicates that the task is running.
TASK_STATE_FAULTEDIndicates that the task completed because of an unhandled exception.
TASK_STATE_RAN_TO_COMPLETIONIndicates that the task completed execution successfully.
TASK_STATE_WAITING_ON_CHILDRENIndicates that the task has finished executing its delegate and is implicitly waiting for attached child tasks to finish.

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

Parallel Extension Internals for the .NET Framework

© 2017 Microsoft