From 9d0403ead60f1be8b54f164291ca4f17d9267b24 Mon Sep 17 00:00:00 2001 From: antiduh Date: Mon, 30 Jun 2014 15:17:51 +0000 Subject: [PATCH] More ReliabilityContracts for finalizer code. --- NSspi/Contexts/SafeContextHandle.cs | 2 ++ NSspi/Credentials/SafeCredentialHandle.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/NSspi/Contexts/SafeContextHandle.cs b/NSspi/Contexts/SafeContextHandle.cs index 393056e..7fbddf7 100644 --- a/NSspi/Contexts/SafeContextHandle.cs +++ b/NSspi/Contexts/SafeContextHandle.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.ConstrainedExecution; using System.Text; using System.Threading.Tasks; @@ -13,6 +14,7 @@ namespace NSspi.Contexts : base() { } + [ReliabilityContract( Consistency.WillNotCorruptState, Cer.Success )] protected override bool ReleaseHandle() { SecurityStatus status = ContextNativeMethods.DeleteSecurityContext( diff --git a/NSspi/Credentials/SafeCredentialHandle.cs b/NSspi/Credentials/SafeCredentialHandle.cs index e6dfa93..2f6eaff 100644 --- a/NSspi/Credentials/SafeCredentialHandle.cs +++ b/NSspi/Credentials/SafeCredentialHandle.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.ConstrainedExecution; using System.Text; using System.Threading.Tasks; @@ -13,6 +14,7 @@ namespace NSspi.Credentials : base() { } + [ReliabilityContract( Consistency.WillNotCorruptState, Cer.Success )] protected override bool ReleaseHandle() { SecurityStatus status = CredentialNativeMethods.FreeCredentialsHandle(