Skip to content

Conversation

@rzikm
Copy link
Member

@rzikm rzikm commented Nov 20, 2025

For stream which wrap another stream (SslStream, compression streams, crypto streams, ....), we can test if async methods are calling only async methods. This should root out cases where we may be mistakenly doing blocking IO calls as part of async stack.

@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 Nov 20, 2025
@rzikm rzikm marked this pull request as ready for review November 25, 2025 12:22
Copilot AI review requested due to automatic review settings November 25, 2025 12:22
@rzikm rzikm added area-Meta and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 25, 2025
@rzikm rzikm requested review from a team and stephentoub November 25, 2025 12:22
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Copilot finished reviewing on behalf of rzikm November 25, 2025 12:24
Copy link
Contributor

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 enforces async-only methods in StreamConformanceTests to ensure that async operations in wrapper streams (SslStream, compression streams, crypto streams) don't perform blocking IO calls. The changes introduce an AsyncOnlyStream wrapper that throws when synchronous methods are called, and update tests to use async operations when testing async code paths.

Key changes:

  • Introduced AsyncOnlyStream wrapper to enforce async-only operations during testing
  • Updated test methods to use async disposal patterns and wrap streams appropriately based on async mode
  • Converted synchronous IO operations to async in SslStream tests to avoid blocking

Reviewed changes

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

File Description
src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs Converted sync Read/Write calls to async ReadAsync/WriteAsync to avoid blocking during TLS 1.3 handshake flush
src/libraries/Common/tests/StreamConformanceTests/System/IO/StreamConformanceTests.cs Added AsyncOnlyStream wrapper class, CreateWrappedStreamsAsync helper, IsAsync helper, updated test disposal patterns to use async, and added IAsyncDisposable to StreamPair

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant