Skip to content

Conversation

VSadov
Copy link
Member

@VSadov VSadov commented Oct 14, 2025

This is a test-only change.

The particular testcase looks into implementation details of active task tracking like s_currentActiveTasks

Runtime async does not have task tracking on synchronous/fast path since no tasks are created, so assumption that as long as we have async code, s_currentActiveTasks will be initialized to something is no longer true.

Test expects "fewer than 10 active tasks" at the end of the scenario.
I changed the test to handle a case if no active tasks were tracked at all. This keeps the test checking for the same thing - that not a lot of active tasks may hang around unexpectedly, but avoids a crash if s_currentActiveTasks is null.

@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 15:54
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies a test to be compatible with runtime async by handling cases where no active task tracking exists. The test was previously assuming that s_currentActiveTasks would always be initialized when async code runs, but runtime async doesn't create tasks on the synchronous/fast path, making this assumption invalid.

  • Updated test to handle null s_currentActiveTasks field
  • Added null check before accessing the Count property
  • Maintained the original assertion logic when active tasks do exist

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
testOut5.txt Tool restoration output log (not relevant to the code change)
AsyncTaskMethodBuilderTests.cs Added null check for s_currentActiveTasks field before accessing its Count property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners runtime-async

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants