cs._list = SecurityFrame.GetStack (1);
// include any current CompressedStack inside the new Capture
- CompressedStack currentCs = Thread.CurrentThread.GetCompressedStack ();
+ CompressedStack currentCs = Thread.CurrentThread.ExecutionContext.SecurityContext.CompressedStack;
if (currentCs != null) {
for (int i=0; i < currentCs._list.Count; i++)
cs._list.Add (currentCs._list [i]);
// Note: CompressedStack.GetCompressedStack doesn't return null
// like Thread.CurrentThread.GetCompressedStack if no compressed
// stack is present.
- CompressedStack cs = Thread.CurrentThread.GetCompressedStack ();
- if (cs == null) {
+
+ CompressedStack cs = Thread.CurrentThread.ExecutionContext.SecurityContext.CompressedStack;
+ if (cs == null || cs.IsEmpty ()) {
cs = CompressedStack.Capture ();
} else {
+ cs = cs.CreateCopy ();
// merge the existing compressed stack (from a previous Thread) with the current
// Thread stack so we can assign "all of it" to yet another Thread
CompressedStack newstack = CompressedStack.Capture ();
Thread t = Thread.CurrentThread;
CompressedStack original = null;
try {
- original = t.GetCompressedStack ();
- t.SetCompressedStack (compressedStack);
+ original = t.ExecutionContext.SecurityContext.CompressedStack;
+ t.ExecutionContext.SecurityContext.CompressedStack = compressedStack;
callback (state);
}
finally {
if (original != null)
- t.SetCompressedStack (original);
+ t.ExecutionContext.SecurityContext.CompressedStack = original;
}
}