internal void SetParentCsp(Microsoft.Win32.SafeHandles.SafeCspHandle parentCsp) { bool addedRef = false; RuntimeHelpers.PrepareConstrainedRegions(); try { parentCsp.DangerousAddRef(ref addedRef); IntPtr rawParentHandle = parentCsp.DangerousGetHandle(); ParentCsp = rawParentHandle; } finally { if (addedRef) { parentCsp.DangerousRelease(); } } }