Repository navigation
Handle MTP test-host controller pipe timeouts by @Evangelink in #11152 (backport to rel/4.4) - #11180
Conversation
Related to microsoft#4774 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Unix systems can report a forced close of an idle pipe as a connection reset instead of EOF. The test was failing on Linux with .NET 9.0 because it didn't handle this exception. This change adds a try-catch block to handle the IOException with ConnectionReset SocketError, which is the expected behavior on Unix when a pipe is closed abruptly. This fixes the failing test ServerDisposal_WhenClientConnectsWithoutSendingRequest_DoesNotHang in the Linux Release build. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fix for Linux Release Build FailureThe failing test \ServerDisposal_WhenClientConnectsWithoutSendingRequest_DoesNotHang\ is failing on Linux with .NET 9.0 because it doesn't handle the \ConnectionReset\ exception that Unix systems throw when a pipe is forcefully closed. Root CauseOn Unix systems (Linux), when a pipe is closed abruptly, the system reports it as a "connection reset" error (\System.IO.IOException\ with inner \System.Net.Sockets.SocketException\ with \SocketErrorCode = ConnectionReset) instead of returning EOF (0 bytes). SolutionThe test needs to be updated to handle this expected Unix behavior. Update the \ServerDisposal_WhenClientConnectsWithoutSendingRequest_DoesNotHang\ method in \ est/UnitTests/Microsoft.Testing.Platform.UnitTests/Hosts/TestHostControllerCancellationTests.cs\ to wrap the read operation in a try-catch block: \\csharp This fix:
Note: This fix has already been applied to the main branch and should be backported to rel/4.4 to fix the pipeline errors on this PR. |
|
Correction: the fix has now been pushed directly to this PR's head branch. The redundant follow-up PR was closed. Targeted validation is in progress. |
Backport of #11152 to rel/4.4
/cc Amaury Levé (@Evangelink)