From f752e04b03b4beb042728645dbaf2c40ba3fa38f Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sun, 12 Mar 2023 15:59:49 +0000 Subject: [PATCH] Fix CA1816 --- .editorconfig | 3 +++ OpenRA.Game/Graphics/SpriteCache.cs | 2 +- OpenRA.Game/Manifest.cs | 2 +- OpenRA.Game/Map/Map.cs | 2 +- OpenRA.Game/Map/MapPreview.cs | 2 +- OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index e57b39688c..ca3fee44ad 100644 --- a/.editorconfig +++ b/.editorconfig @@ -830,6 +830,9 @@ dotnet_diagnostic.CA5351.severity = warning ### Usage Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/usage-warnings +# Call GC.SuppressFinalize correctly. +dotnet_diagnostic.CA1816.severity = warning + # Rethrow to preserve stack details. dotnet_diagnostic.CA2200.severity = warning diff --git a/OpenRA.Game/Graphics/SpriteCache.cs b/OpenRA.Game/Graphics/SpriteCache.cs index bbe6bd3403..c981b5e342 100644 --- a/OpenRA.Game/Graphics/SpriteCache.cs +++ b/OpenRA.Game/Graphics/SpriteCache.cs @@ -18,7 +18,7 @@ using OpenRA.Primitives; namespace OpenRA.Graphics { - public class SpriteCache : IDisposable + public sealed class SpriteCache : IDisposable { public readonly Dictionary SheetBuilders; readonly ISpriteLoader[] loaders; diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index 01d8106164..d9739f7585 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -65,7 +65,7 @@ namespace OpenRA } /// Describes what is to be loaded in order to run a mod. - public class Manifest : IDisposable + public sealed class Manifest : IDisposable { public readonly string Id; public readonly IReadOnlyPackage Package; diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 4b51221224..9315665f1b 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -149,7 +149,7 @@ namespace OpenRA } } - public class Map : IReadOnlyFileSystem, IDisposable + public sealed class Map : IReadOnlyFileSystem, IDisposable { public const int SupportedMapFormat = 11; public const int CurrentMapFormat = 12; diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index cdfa253ea9..e38def96ac 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -61,7 +61,7 @@ namespace OpenRA public readonly int mapformat; } - public class MapPreview : IDisposable, IReadOnlyFileSystem + public sealed class MapPreview : IDisposable, IReadOnlyFileSystem { /// Wrapper that enables map data to be replaced in an atomic fashion. sealed class InnerData diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs index e128d579e7..5d45e236e4 100644 --- a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs +++ b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Cnc.Graphics } } - public class VoxelModelCache : IModelCache + public sealed class VoxelModelCache : IModelCache { readonly VoxelLoader loader; readonly Dictionary> models = new();