Open Snaaio opened 2 weeks ago
Tagging the people that were already involved in #85326: @egil @tarekgh @stephentoub
This issue is related to or a duplicate of https://github.com/dotnet/runtime/issues/92264. We previously investigated this and decided against making changes because, while altering it might help in some scenarios, it would cause problems in others.
I suggest closing this issue. If you encounter any problems, we can recommend an appropriate workaround.
@stephentoub let us know what you think.
Thanks for the info. Bit of a bummer, but understandable ;-)
Is there a better workaround than having to await Task.Yield()
(or even a small delay), preferably one that keeps tests deterministic?
What is your failing test? Could you please write your test case here? and why you are not preferring await Task.Yield()
? or you are curious to know if there is any other workaround?
This was already solved for TimeProviderTaskExtensions Delay in #85326 (PR #90489). See the rationale there.
I think this should be fixed for WaitAsync as well, because of the same rationale (and now also for consistency with Delay).
Therefore I propose to change: https://github.com/dotnet/runtime/blob/cd9cc877d157684dd69ccc4d2cabaa60368b1524/src/libraries/Microsoft.Bcl.TimeProvider/src/System/Threading/Tasks/TimeProviderTaskExtensions.cs
public WaitAsyncState(CancellationToken cancellationToken) : base(TaskCreationOptions.RunContinuationsAsynchronously)
to:public WaitAsyncState(CancellationToken cancellationToken)