From fbfbab03f380b72be350fe8aa007c40d825167eb Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 30 Nov 2022 19:02:17 +0000 Subject: [PATCH] Suppress CA2000, false positive This value is in fact disposed, just not here. See DestroyNative(nint) --- VpSharp/src/Internal/Connection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VpSharp/src/Internal/Connection.cs b/VpSharp/src/Internal/Connection.cs index 60edf31..afb8199 100644 --- a/VpSharp/src/Internal/Connection.cs +++ b/VpSharp/src/Internal/Connection.cs @@ -76,11 +76,13 @@ internal sealed class Connection : IDisposable public static nint CreateNative(nint vpConnection, nint context) { +#pragma warning disable CA2000 GCHandle contextHandle = GCHandle.FromIntPtr(context); var connection = new Connection(vpConnection, contextHandle.Target!); GCHandle handle = GCHandle.Alloc(connection, GCHandleType.Normal); var ptr = GCHandle.ToIntPtr(handle); return ptr; +#pragma warning restore CA2000 } public static void DestroyNative(nint ptr)