-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A question about PipeOptions.Asynchronous and async/await #24567
Comments
This seems to be the case for |
No, that's not the case. It should work fine with the task-based method. Please share the standalone repro in the issue. |
@stephentoub There you go PipesAsyncAwait471.zip p.s. I ran the exact same code on Core 2. |
PipeOptions.Asynchronous is simply causing a different order of execution than PipeOptions.None, and that's exposing a race condition / deadlock in your code. You can see the effect of it if you use Task Manager, for example, to monitor the thread count of your process... you should see it creeping up at a rate of appx 1 thread per second, until it gets to around 100 threads (maybe 110 or so), at which point your code runs to completion. Or if you add |
@stephentoub Okay thanks, I'll look into it. |
I'm not sure but it seems like
PipeOptions.Asynchronous
should only be used with the old async APIs Begin* and End* pair, is this correct? because from my tests using an example I wrote for an issue I had at SO (at the bottom of the page) it hangs if it isn't set toPipeOptions.None
this surprised me because behind the scenes it seems like it takes advantage over the old APIs but otherwise it certainly possible that I'm doing something wrong.Tested with .NET 4.7.1 and Core 2.0.
The text was updated successfully, but these errors were encountered: