Skip to content

Commit f73356c

Browse files
authored
Remove noisy assert from Task (#86445)
1 parent 7a532a7 commit f73356c

File tree

1 file changed

+4
-4
lines changed
  • src/libraries/System.Private.CoreLib/src/System/Threading/Tasks

1 file changed

+4
-4
lines changed

src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2544,10 +2544,10 @@ internal void UnsafeSetContinuationForAwait(IAsyncStateMachineBox stateMachineBo
25442544

25452545
// This code path doesn't emit all expected TPL-related events, such as for continuations.
25462546
// It's expected that all callers check whether events are enabled before calling this function,
2547-
// and only call it if they're not, so we assert. However, as events can be dynamically turned
2548-
// on and off, it's possible this assert could fire even when used correctly. If it becomes
2549-
// noisy, it can be deleted.
2550-
Debug.Assert(!TplEventSource.Log.IsEnabled());
2547+
// and only call it if they're not. However, as events can be dynamically turned
2548+
// on and off, it's possible this assert could fire even when used correctly. Do not call this
2549+
// method unless you've checked that TplEventSource.Log.IsEnabled() is false (if it becomes true after
2550+
// the check, that's fine, and a natural race condition that's unavoidable).
25512551

25522552
// If the caller wants to continue on the current context/scheduler and there is one,
25532553
// fall back to using the state machine's delegate.

0 commit comments

Comments
 (0)