Uh oh!
There was an error while loading. Please reload this page.
Fix UnobservedTaskException from SemaphoreSlim.WaitAsync - #60890
Conversation
ghost
commented
Oct 26, 2021
Tagging subscribers to this area: @dotnet/area-system-threading-tasks Issue DetailsIf a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed. This fixes that by marking any such exceptions as having been observed. Fixes #60856
|
If a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed. This fixes that by marking any such exceptions as having been observed.
743ca48 to
404649cCompareadamsitnik
commented
Nov 8, 2021
@stephentoub should we backport it to 6.0.1? |
stephentoub
commented
Nov 9, 2021
It'd be fine to propose doing so if you think it's worthwhile. |
adamsitnik
commented
Nov 10, 2021
I think that it's worthwhile. It's quite common to use |
stephentoub
commented
Nov 10, 2021
It should be low risk; it's just setting a flag that says "treat this as already observed". We could let it bake in main for a bit first if desired, or not. |
stephentoub
commented
Nov 12, 2021
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1451429820 |
If a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed. This fixes that by marking any such exceptions as having been observed.
Fixes#60856