Skip to content

Commit

Permalink
Suppress
Browse files Browse the repository at this point in the history
Suppress `S3234` warnings in debug builds.
  • Loading branch information
martincostello committed Sep 17, 2024
1 parent 995090e commit 7d0c672
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Polly/Utilities/TimedLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ private static TimedLock Lock(object o, TimeSpan timeout)
if (!Monitor.TryEnter(o, timeout))
{
#if DEBUG
#pragma warning disable S3234 // "GC.SuppressFinalize" should not be invoked for types without destructors
#pragma warning disable S3971 // Do not call 'GC.SuppressFinalize'
GC.SuppressFinalize(tl._leakDetector);
#pragma warning restore S3971
#pragma warning restore S3234
#endif
throw new LockTimeoutException();
}
Expand All @@ -61,7 +63,9 @@ public void Dispose()
// the error. If Dispose is called, we suppress the
// finalizer.
#if DEBUG
#pragma warning disable S3234 // "GC.SuppressFinalize" should not be invoked for types without destructors
GC.SuppressFinalize(_leakDetector);
#pragma warning restore S3234
#endif
}

Expand Down

0 comments on commit 7d0c672

Please sign in to comment.