-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
System.Threading.Tasks.Dataflow.DataflowBlock.ReceiveAsync does not use custom scheduler #83159
Comments
Tagging subscribers to this area: @dotnet/area-system-threading-tasks Issue DetailsDescription
runtime/src/libraries/System.Threading.Tasks.Dataflow/src/Base/DataflowBlock.cs Line 1073 in 14123c9
Reproduction StepsCreate block, e.g. Expected behaviorShould use configured task scheduler or at least be well documented that there is no configuration of task scheduling for some dataflow extension methods. Actual behaviorSurprising behavior of using unconfigurable global default scheduler. While global default may be sensible default, should either allow customization or document the limitation. Regression?No response Known WorkaroundsNone, have to not use the extension methods. ConfigurationNo response Other informationNo response
|
Which tasks aren't being scheduled to the block's scheduler that you'd expect to be? |
I am making a deterministic manual task scheduler for Temporal workflows at https://github.com/temporalio/sdk-dotnet. I already have a custom event source listener that checks that all tasks are created on my scheduler when running with my scheduler as the current scheduler to prevent anyone from using the default scheduler in workflows. And of course https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2008 catches some (though I request they actually do use But this triggered my detector because the task for
I can understand if this won't be supported, but maybe at least some docs saying dataflow extension calls cannot use custom scheduling. |
Specifically runtime/src/libraries/System.Threading.Tasks.Dataflow/src/Base/DataflowBlock.cs Lines 1323 to 1329 in 5f94bff
|
@stephentoub what's your thought on this one. Is there an issue here with the scheduling or should we just document this? |
This is behaving as designed, so from that perspective, it would just be further clarification as needed in the docs. Factoring in a different scheduler would require new APIs / overloads; if that's what's desired, it'd be good to go through the API proposal route.
Thanks for the details. If you'd like to propose a new overload, please feel free to open an API issue for that. |
👍 I don't have a concrete proposal, so just some docs clarity would be ideal (thanks!) |
Description
ReceiveAsync
creates aReceiveTarget
atruntime/src/libraries/System.Threading.Tasks.Dataflow/src/Base/DataflowBlock.cs
Line 1073 in 14123c9
Reproduction Steps
Create block, e.g.
var block = new BufferBlock<bool>(new() { TaskScheduler = TaskScheduler.Current });
and confirm thatblock.ReceiveAsync()
does not use it..Expected behavior
Should use configured task scheduler or at least be well documented that there is no configuration of task scheduling for some dataflow extension methods.
Actual behavior
Surprising behavior of using unconfigurable global default scheduler. While global default may be sensible default, should either allow customization or document the limitation.
Regression?
No response
Known Workarounds
None, have to not use the extension methods.
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: