Skip to content

Commit e3ecf59

Browse files
Cleanup.
1 parent 14e58ea commit e3ecf59

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

DeferredCleanupBase.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public bool IsRunning
4444
private set;
4545
}
4646

47-
private readonly object _timerSync = new object();
47+
private readonly object _timerSync = new();
4848
private Timer? _cleanupTimer;
4949

5050

@@ -95,9 +95,7 @@ public void SetCleanup(CleanupMode mode = CleanupMode.Deferred)
9595
// No past due action in order to prevent another thread from firing...
9696
LastCleanup = DateTime.MaxValue;
9797
DeferCleanup();
98-
#pragma warning disable CA2008 // Last cleanup value protects against repeat task creation.
9998
Task.Factory.StartNew(Cleanup);
100-
#pragma warning restore CA2008
10199
}
102100
}
103101
break;
@@ -145,12 +143,10 @@ private void Cleanup(object? state)
145143
{
146144
OnCleanup();
147145
}
148-
#pragma warning disable CA1031 // Do not catch general exception types
149146
catch (Exception ex)
150147
{
151148
Debug.WriteLine(ex.ToString());
152149
}
153-
#pragma warning restore CA1031 // Do not catch general exception types
154150

155151
lock (_timerSync)
156152
{

Open.Disposable.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
7+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
78
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
89
<Authors>electricessence</Authors>
910
<Description>

0 commit comments

Comments
 (0)