Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 1f60b07

Browse files
committed
Merge pull request #1939 from stephentoub/fix_process_asyncreading
Fix bug in Process' AsyncStreamReader.BeginReadLine
2 parents 7957531 + 5ff0c4c commit 1f60b07

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/System.Diagnostics.Process/src/System/Diagnostics/AsyncStreamReader.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ internal void BeginReadLine()
6969
if (_sb == null)
7070
{
7171
_sb = new StringBuilder(DefaultBufferSize);
72-
_readToBufferTask = Task.Factory.StartNew(s => ((AsyncStreamReader)s).ReadBuffer(),
73-
this, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
72+
_readToBufferTask = Task.Run((Func<Task>)ReadBufferAsync);
7473
}
7574
else
7675
{
@@ -84,7 +83,7 @@ internal void CancelOperation()
8483
}
8584

8685
// This is the async callback function. Only one thread could/should call this.
87-
private async Task ReadBuffer()
86+
private async Task ReadBufferAsync()
8887
{
8988
while (true)
9089
{

0 commit comments

Comments
 (0)