Handle StreamBuffer disposal race in SslStream test - #133021
Open
rzikm wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cfe60e99-25a1-4878-9f47-4dff5e9b1537
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones |
MihaZupan
approved these changes
Sep 1, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the SslStreamDisposeTest.Dispose_ParallelWithHandshake_ThrowsODE test to treat additional InvalidOperationException stack trace origins as expected during the dispose/handshake race, improving test resilience across platforms/runtimes.
Changes:
- Expands the exception filter in
ValidateExceptionAsyncto acceptSystem.IO.StreamBuffer.TryWriteToBufferandSystem.IO.StreamBuffer.WriteAsyncframes in addition toSystem.IO.ConnectedStreams. - Keeps the filter scoped to specific method names rather than broadly accepting all
StreamBufferfailures.
File summaries
| File | Description |
|---|---|
| src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamDisposeTest.cs | Broadens the expected InvalidOperationException stack-trace filter to cover additional disposal-race call paths. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
Comment on lines
+152
to
156
| catch (InvalidOperationException ex) when (ex.StackTrace is null || | ||
| ex.StackTrace.Contains("System.IO.ConnectedStreams") || | ||
| ex.StackTrace.Contains("System.IO.StreamBuffer.TryWriteToBuffer") || | ||
| ex.StackTrace.Contains("System.IO.StreamBuffer.WriteAsync")) | ||
| { |
wfurt
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dispose_ParallelWithHandshake_ThrowsODEcan surface the expected disposal race throughStreamBuffer.TryWriteToBufferon Alpine, where theConnectedStreamsframe is absent from the stack trace. This caused the test to fail after #132748 narrowed the exception filter toConnectedStreams.Accept the two specific
StreamBufferwrite methods in addition toConnectedStreams. Matching the methods rather than the entire type avoids hiding unrelatedInvalidOperationExceptionfailures fromStreamBuffer.Testing: the targeted outer-loop test passed. The full System.Net.Security functional suite ran 5,369 tests; this test passed, with one unrelated failure in
TlsSessionTests.ClientSession_ExternalCertificateValidation_AcceptWithDefaultValidation_FailsOnUntrustedCerton the local Windows environment.Note
This pull request description was created by GitHub Copilot.