1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 19:18:47 +00:00

Suppress CA2000, false positive

This value is in fact disposed, just not here. See DestroyNative(nint)
This commit is contained in:
Oliver Booth 2022-11-30 19:02:17 +00:00
parent 220eeeec69
commit fbfbab03f3
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -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)