dotnet / roslyn-analyzers

MIT License
1.58k stars 464 forks source link

Prevent SemaphoreSlim.Wait(0) from triggering CA1849 #7310

Closed CollinAlpert closed 4 months ago

CollinAlpert commented 4 months ago

Affected analyzer: UseAsyncMethodInAsyncContext Affected diagnostic IDs: CA1849

This PR suppresses CA1849 for calls to SemaphoreSlim.Wait(0), SemaphoreSlim.Wait(0, CancellationToken), SemaphoreSlim.Wait(TimeSpan.Zero) and SemaphoreSlim.Wait(TimeSpan.Zero, CancellationToken).

Fixes #7271

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 98.41270% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 96.48%. Comparing base (bc8aca0) to head (6d45c87).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7310 +/- ## ======================================== Coverage 96.47% 96.48% ======================================== Files 1443 1443 Lines 345400 345525 +125 Branches 11364 11369 +5 ======================================== + Hits 333239 333368 +129 + Misses 9282 9275 -7 - Partials 2879 2882 +3 ```
CollinAlpert commented 4 months ago

@sharwell Thanks for reviewing this!

CollinAlpert commented 4 months ago

@sharwell Can this be merged?