Repository: dotnet/runtime
File: src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs (C#)

Code before:
            TaskScheduledWasFired = 0x40000000,      // bin: 0100 0000 0000 0000 0000 0000 0000 0000

            CompletedMask = Canceled | Faulted | RanToCompletion, // A mask for all of the final states a task may be in. SOS DumpAsync command depends on these values.
            OptionsMask = 0xFFFF,                    // signifies the Options portion of m_stateFlags bin: 0000 0000 0000 0000 1111 1111 1111 1111
        }

        // Values for ContingentProperties.m_internalCancellationRequested.
        private const int CANCELLATION_REQUESTED = 0x1;

        // Can be null, a single continuation, a list of continuations, or s_taskCompletionSentinel,
        // in that order. The logic arround this object assumes it will never regress to a previous state.
        private volatile object? m_continuationObject; // SOS DumpAsync command depends on this name

        // m_continuationObject is set to this when the task completes.
        private static readonly object s_taskCompletionSentinel = new object();

        // A private flag that would be set (only) by the debugger
        // When true the Async Causality logging trace is enabled as well as a dictionary to relate operation ids with Tasks
        internal static bool s_asyncDebuggingEnabled; // false by default

        // This dictionary relates the task id, from an operation id located in the Async Causality log to the actual
        // task. This is to be used by the debugger ONLY. Task in this dictionary represent current active tasks.
        private static Dictionary<int, Task>? s_currentActiveTasks;

#if !MONO
        // Dictionary that relates a runtime-async Task's ID to the QPC tick count when the current inflight invocation started.
        // Needed because Continuations that are inflight have already been dequeued from the chain.
        private static Dictionary<int, long>? s_runtimeAsyncTaskTimestamps;
        // Dictionary to store debug info about runtime-async Continuations.
        // The TickCount field stores the QPC tick count when the logical invocation to which the Continuation belongs started.
        // The ID field stores a unique ID for the Continuation, similar to Task IDs.
        private static Dictionary<Continuation, long>? s_runtimeAsyncContinuationTimestamps;
#endif
        // These methods are a way to access the dictionary both from this class and for other classes that also
        // activate dummy tasks. Specifically the AsyncTaskMethodBuilder and AsyncTaskMethodBuilder<>
        internal static bool AddToActiveTasks(Task task)
        {
            Debug.Assert(task != null, "Null Task objects can't be added to the ActiveTasks collection");

            Dictionary<int, Task> activeTasks =
                Volatile.Read(ref s_currentActiveTasks) ??
                Interlocked.CompareExchange(ref s_currentActiveTasks, new Dictionary<int, Task>(), null) ??
                s_currentActiveTasks;

            int taskId = task.Id;
            lock (activeTasks)
            {
                activeTasks[taskId] = task;
            }
            // always return true to keep signature as bool for backwards compatibility
            return true;

Review comment (suggestion):
```suggestion
        // Dictionary that relates a runtime-async Task's ID to the timestamp when the current inflight invocation started.
```

Code after:
            TaskScheduledWasFired = 0x40000000,      // bin: 0100 0000 0000 0000 0000 0000 0000 0000

            CompletedMask = Canceled | Faulted | RanToCompletion, // A mask for all of the final states a task may be in. SOS DumpAsync command depends on these values.
            OptionsMask = 0xFFFF,                    // signifies the Options portion of m_stateFlags bin: 0000 0000 0000 0000 1111 1111 1111 1111
        }

        // Values for ContingentProperties.m_internalCancellationRequested.
        private const int CANCELLATION_REQUESTED = 0x1;

        // Can be null, a single continuation, a list of continuations, or s_taskCompletionSentinel,
        // in that order. The logic arround this object assumes it will never regress to a previous state.
        private volatile object? m_continuationObject; // SOS DumpAsync command depends on this name

        // m_continuationObject is set to this when the task completes.
        private static readonly object s_taskCompletionSentinel = new object();

        // A private flag that would be set (only) by the debugger
        // When true the Async Causality logging trace is enabled as well as a dictionary to relate operation ids with Tasks
        internal static bool s_asyncDebuggingEnabled; // false by default

        // This dictionary relates the task id, from an operation id located in the Async Causality log to the actual
        // task. This is to be used by the debugger ONLY. Task in this dictionary represent current active tasks.
        private static Dictionary<int, Task>? s_currentActiveTasks;

#if !MONO
        // Dictionary that relates a runtime-async Task's ID to the timestamp when the current inflight invocation started.
        // Needed because Continuations that are inflight have already been dequeued from the chain.
        private static Dictionary<int, long>? s_runtimeAsyncTaskTimestamps;
        // Dictionary to store the timestamp when the logical invocation to which the Continuation belongs started.
        private static Dictionary<object, long>? s_runtimeAsyncContinuationTimestamps;
#endif
        // These methods are a way to access the dictionary both from this class and for other classes that also
        // activate dummy tasks. Specifically the AsyncTaskMethodBuilder and AsyncTaskMethodBuilder<>
        internal static bool AddToActiveTasks(Task task)
        {
            Debug.Assert(task != null, "Null Task objects can't be added to the ActiveTasks collection");

            Dictionary<int, Task> activeTasks =
                Volatile.Read(ref s_currentActiveTasks) ??
                Interlocked.CompareExchange(ref s_currentActiveTasks, new Dictionary<int, Task>(), null) ??
                s_currentActiveTasks;

            int taskId = task.Id;
            lock (activeTasks)
            {
                activeTasks[taskId] = task;
            }
            // always return true to keep signature as bool for backwards compatibility
            return true;
        }