Skip to content

Convert blocking Task.WaitAll to async/await in concurrency tests#7

Merged
daohainam merged 2 commits intomainfrom
copilot/fix-xunit-blocking-warning
Jan 17, 2026
Merged

Convert blocking Task.WaitAll to async/await in concurrency tests#7
daohainam merged 2 commits intomainfrom
copilot/fix-xunit-blocking-warning

Conversation

Copy link
Contributor

Copilot AI commented Jan 17, 2026

xunit analyzer warns that test methods using blocking task operations (Task.WaitAll) can cause deadlocks.

Changes

  • Converted two test methods to async Task signatures
  • Replaced Task.WaitAll(tasks.ToArray()) with await Task.WhenAll(tasks)

Before:

[Fact]
public void Concurrent_Inserts_Are_Thread_Safe()
{
    // ...
    Task.WaitAll(tasks.ToArray());
}

After:

[Fact]
public async Task Concurrent_Inserts_Are_Thread_Safe()
{
    // ...
    await Task.WhenAll(tasks);
}
Original prompt

fix this xunit warning: Test methods should not use blocking task operations, as they can cause deadlocks. Use an async test method and await instead.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…oncurrency tests

Co-authored-by: daohainam <11513104+daohainam@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix xUnit warning for blocking task operations Convert blocking Task.WaitAll to async/await in concurrency tests Jan 17, 2026
Copilot AI requested a review from daohainam January 17, 2026 16:21
@daohainam daohainam marked this pull request as ready for review January 17, 2026 16:34
@daohainam daohainam merged commit f1ddc65 into main Jan 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments