[System.Security.SecuritySafeCritical] // auto-generated public SecurityContext CreateCopy() { if (!isNewCapture) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotNewCaptureContext")); } SecurityContext sc = new SecurityContext(); sc.isNewCapture = true; sc._disableFlow = _disableFlow; #if !FEATURE_PAL && FEATURE_IMPERSONATION if (WindowsIdentity != null) { sc._windowsIdentity = new WindowsIdentity(WindowsIdentity.AccessToken); } #endif //!FEATURE_PAL && FEATURE_IMPERSONATION if (_compressedStack != null) { sc._compressedStack = _compressedStack.CreateCopy(); } return(sc); }
public static void Capture_GetCompressedStack_CreateCopy_Test() { CompressedStack compressedStack = CompressedStack.Capture(); Assert.NotNull(compressedStack); Assert.NotNull(compressedStack.CreateCopy()); Assert.NotNull(CompressedStack.GetCompressedStack()); Assert.NotNull(CompressedStack.GetCompressedStack().CreateCopy()); }
public void CreateCopy() { CompressedStack cs1 = CompressedStack.Capture (); CompressedStack cs2 = cs1.CreateCopy (); Assert.IsFalse (cs1.Equals (cs2), "cs1.Equals (cs2)"); Assert.IsFalse (cs2.Equals (cs1), "cs2.Equals (cs1)"); Assert.IsFalse (cs1.GetHashCode () == cs2.GetHashCode (), "GetHashCode"); Assert.IsFalse (Object.ReferenceEquals (cs1, cs2), "ReferenceEquals"); }
[System.Security.SecuritySafeCritical] // auto-generated public SecurityContext CreateCopy() { if (!isNewCapture) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotNewCaptureContext")); } SecurityContext sc = new SecurityContext(); sc.isNewCapture = true; sc._disableFlow = _disableFlow; if (_compressedStack != null) { sc._compressedStack = _compressedStack.CreateCopy(); } return(sc); }