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
SemaphoreSlim.Wait will not block if 0 (or TimeSpan.Zero) is passed as the timeout:
millisecondsTimeout:
The number of milliseconds to wait, System.Threading.Timeout.Infinite(-1) to
wait indefinitely, or zero to test the state of the wait handle and return immediately.
Therefore this rule is a false positive in this case.
Steps To Reproduce
using System.Threading;using System.Threading.Tasks;staticasync Task Main(){usingSemaphoreSlims=new(0);
s.Wait(0);}
Analyzer
Diagnostic ID: CA1849:
Call async methods when in an async method
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 8.0.0, 9.0.0-preview.24122.1
Describe the bug
SemaphoreSlim.Wait will not block if 0 (or
TimeSpan.Zero
) is passed as the timeout:Therefore this rule is a false positive in this case.
Steps To Reproduce
Expected behavior
No warning.
Actual behavior
The text was updated successfully, but these errors were encountered: