Add net11 Process.ReadAllLines - #590
Merged
Merged
Conversation
Adds the synchronous counterpart to the already polyfilled
ReadAllLinesAsync:
IEnumerable<ProcessOutputLine> ReadAllLines(TimeSpan? timeout = null)
Semantics were taken from net11 by driving a child process that writes
to both streams with delays between them:
* the sequence is lazy, and lines are yielded as they arrive rather than
being collected first
* standard output and standard error are interleaved in arrival order
* exceeding the timeout throws TimeoutException, matching the other
synchronous helpers on Process
* a process without redirected output throws InvalidOperationException
Implemented as an iterator over the same queue and semaphore arrangement
as ReadAllLinesAsync, with a blocking wait bounded by the remaining
timeout. Because an iterator does no work until it is enumerated, the
timeout is measured from the point enumeration starts, which is recorded
as a note.
No test asserts the TimeoutException path. Provoking it needs a child
that stays quiet for a known interval, and every candidate available to
the test project either exits promptly or makes the assertion depend on
timing. The path was exercised by hand against net11 instead.
This was referenced Sep 10, 2026
This was referenced Sep 11, 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.
Adds the synchronous counterpart to the already polyfilled
ReadAllLinesAsync:API count 1072 to 1073. This was the last item outstanding from the net11 RC1 sweep.
Semantics
Taken from net11 by driving a child process that writes to both streams with delays between them, rather than assumed:
TimeoutException, matchingWaitForExitOrThrowand the other synchronous helpers onProcessInvalidOperationExceptionImplementation
An iterator over the same
ConcurrentQueueandSemaphoreSlimarrangementReadAllLinesAsyncalready uses, with a blocking wait bounded by the remaining timeout.Because an iterator body does not run until it is enumerated, the timeout is measured from the point enumeration starts rather than from the call. Recorded as a
//Note:.One gap in the tests
Nothing asserts the
TimeoutExceptionpath. Provoking it needs a child that stays quiet for a known interval, and every candidate available to the test project either exits promptly or makes the assertion depend on timing, which would be flaky on CI. The path was exercised by hand against net11 with a purpose built child instead. For the same reason there is no test asserting laziness, though that was verified the same way.The timeout parameter is still covered, with a value large enough not to fire, so the remaining-time arithmetic is exercised.
Verification
Consumebuilds clean in Debug across all 22 target frameworks.PublicTests,EmbeddedTests,UnsafeTests,NoRefsTestsandNoExtrasTests.