You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This trivial example doesn't support Func<Task> functions, and doing so properly is tricky. Avoiding deadlocks in this pattern is particularly tricky as it must be made compliant with the 3rd threading rule.
Describe the solution you'd like
An analyzer that detects when continuations of a Task field is assigned back to the original field and reports a diagnostic (warning or info) suggesting that ReentrantSemaphore be used instead.
The text was updated successfully, but these errors were encountered:
@AArnott task chaining is a frequent item I hit, and improving it would be a high value win IMO. You may be completely right about this analyzer already but I can be a tough sell so I really want to convince myself that the solution is good all around. Whatever path we use, I expect if we ever want to change it, it will be even harder than switching away from task chaining.
There may be more than one use case for task chaining. The one I'm interested in (and that hopefully the analyzer can be taught to recognize) is when it's used to limit concurrent execution to 1 without affinitizing to a particular thread.
Is your feature request related to a problem? Please describe.
People regularly use task chaining to accomplish a serialized, in-order execution of arbitrary operations. For example:
This trivial example doesn't support
Func<Task>
functions, and doing so properly is tricky. Avoiding deadlocks in this pattern is particularly tricky as it must be made compliant with the 3rd threading rule.Describe the solution you'd like
An analyzer that detects when continuations of a
Task
field is assigned back to the original field and reports a diagnostic (warning or info) suggesting thatReentrantSemaphore
be used instead.The text was updated successfully, but these errors were encountered: