<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0-preview.6.20305.6" />

SafeAccessTokenHandle

public sealed class SafeAccessTokenHandle : SafeHandle
Provides a safe handle to a Windows thread or process access token. For more information, see Access Tokens.
using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Microsoft.Win32.SafeHandles { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public sealed class SafeAccessTokenHandle : SafeHandle { public static SafeAccessTokenHandle InvalidHandle { get { throw new PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } public override bool IsInvalid { get { throw new PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } public SafeAccessTokenHandle(IntPtr handle) : base((IntPtr)0, false) { throw new PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } protected override bool ReleaseHandle() { throw new PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } }