diff --git a/Harmony/Documentation/GlobalSuppressions.cs b/Harmony/Documentation/GlobalSuppressions.cs
index 35b3f4e0..8bf71a0e 100644
--- a/Harmony/Documentation/GlobalSuppressions.cs
+++ b/Harmony/Documentation/GlobalSuppressions.cs
@@ -19,5 +19,6 @@
[assembly: SuppressMessage("Performance", "CA1806")]
[assembly: SuppressMessage("Performance", "CA1859")]
+[assembly: SuppressMessage("", "CA1016")]
[assembly: SuppressMessage("", "CS0649")]
[assembly: SuppressMessage("", "IDE0251")]
diff --git a/Harmony/Tools/AccessTools.cs b/Harmony/Tools/AccessTools.cs
index cac03790..a6656b50 100644
--- a/Harmony/Tools/AccessTools.cs
+++ b/Harmony/Tools/AccessTools.cs
@@ -9,8 +9,6 @@
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
-
-
#if NET45_OR_GREATER || NETSTANDARD || NETCOREAPP
using System.Runtime.CompilerServices;
#endif
diff --git a/HarmonyTests/GlobalSuppressions.cs b/HarmonyTests/GlobalSuppressions.cs
index 549481c4..0c8f7490 100644
--- a/HarmonyTests/GlobalSuppressions.cs
+++ b/HarmonyTests/GlobalSuppressions.cs
@@ -11,6 +11,7 @@
[assembly: SuppressMessage("Design", "CA1034")]
[assembly: SuppressMessage("Design", "CA1052")]
+[assembly: SuppressMessage("", "CA1016")]
[assembly: SuppressMessage("", "CS0169")]
[assembly: SuppressMessage("", "CA1401")]
diff --git a/HarmonyTests/HarmonyTests.csproj b/HarmonyTests/HarmonyTests.csproj
index 857cbb34..b33678de 100644
--- a/HarmonyTests/HarmonyTests.csproj
+++ b/HarmonyTests/HarmonyTests.csproj
@@ -52,7 +52,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -65,7 +65,7 @@
-
+
diff --git a/HarmonyTests/Patching/FinalizerPatches.cs b/HarmonyTests/Patching/FinalizerPatches.cs
index d4276914..637aff87 100644
--- a/HarmonyTests/Patching/FinalizerPatches.cs
+++ b/HarmonyTests/Patching/FinalizerPatches.cs
@@ -3,9 +3,7 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Reflection;
-using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace HarmonyLibTests.Patching
@@ -22,7 +20,7 @@ public void Test_FinalizerPatchOrder()
harmony.PatchCategory("finalizer-test");
try
{
- _ = progress.Clear();
+ progress = new();
Class.Test();
Assert.Fail("Should throw an exception");
}
diff --git a/HarmonyTests/Patching/Specials.cs b/HarmonyTests/Patching/Specials.cs
index 55215905..640cb356 100644
--- a/HarmonyTests/Patching/Specials.cs
+++ b/HarmonyTests/Patching/Specials.cs
@@ -74,7 +74,7 @@ public void Test_PatchResultRef()
Assert.AreEqual(new[] { 1, 0 }, ResultRefStruct.numbersPrefix);
Assert.AreEqual(new[] { 2, 0 }, ResultRefStruct.numbersPostfix);
Assert.AreEqual(new[] { 3 }, ResultRefStruct.numbersPostfixWithNull);
- Assert.Throws(() => test.ToFinalizer(), "ToFinalizer method does not throw");
+ _ = Assert.Throws(() => test.ToFinalizer(), "ToFinalizer method does not throw");
Assert.AreEqual(new[] { 5, 0 }, ResultRefStruct.numbersMixed);
var replacements = processor.Patch();
@@ -255,7 +255,7 @@ public void Test_PatchException()
);
DeadEndCode_Patch1.prefixCalled = false;
DeadEndCode_Patch1.postfixCalled = false;
- test.Method();
+ _ = test.Method();
Assert.True(DeadEndCode_Patch1.prefixCalled);
Assert.True(DeadEndCode_Patch1.postfixCalled);
}
diff --git a/HarmonyTests/Patching/Transpiling.cs b/HarmonyTests/Patching/Transpiling.cs
index 438a4967..d35f9e82 100644
--- a/HarmonyTests/Patching/Transpiling.cs
+++ b/HarmonyTests/Patching/Transpiling.cs
@@ -1,7 +1,6 @@
using HarmonyLib;
using HarmonyLibTests.Assets;
using NUnit.Framework;
-using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
diff --git a/HarmonyTests/Tools/Assets/AttributesClass.cs b/HarmonyTests/Tools/Assets/AttributesClass.cs
index af8ffc8b..d85457a7 100644
--- a/HarmonyTests/Tools/Assets/AttributesClass.cs
+++ b/HarmonyTests/Tools/Assets/AttributesClass.cs
@@ -1,5 +1,4 @@
using HarmonyLib;
-using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
diff --git a/HarmonyTests/Tools/Assets/CodeMatcherClass.cs b/HarmonyTests/Tools/Assets/CodeMatcherClass.cs
index 3c7edf52..2658ab2a 100644
--- a/HarmonyTests/Tools/Assets/CodeMatcherClass.cs
+++ b/HarmonyTests/Tools/Assets/CodeMatcherClass.cs
@@ -1,8 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
namespace HarmonyTests.Tools.Assets
{
public class CodeMatcherClass
diff --git a/HarmonyTests/Tools/TestAccessTools.cs b/HarmonyTests/Tools/TestAccessTools.cs
index 0e7668fb..5437e72e 100644
--- a/HarmonyTests/Tools/TestAccessTools.cs
+++ b/HarmonyTests/Tools/TestAccessTools.cs
@@ -4,10 +4,12 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using static HarmonyLibTests.Assets.AccessToolsMethodDelegate;
+#if NETCOREAPP
+using System.Linq;
+#endif
namespace HarmonyLibTests.Tools
{