internal unsafe static void ReflectedLinkDemandInvoke (MethodBase mb)
{
RuntimeDeclSecurityActions klass;
RuntimeDeclSecurityActions method;
if (!GetLinkDemandSecurity (mb, &klass, &method))
return;
PermissionSet ps = null;
if (klass.cas.size > 0) {
ps = Decode (klass.cas.blob, klass.cas.size);
}
if (klass.noncas.size > 0) {
PermissionSet p = Decode (klass.noncas.blob, klass.noncas.size);
ps = (ps == null) ? p : ps.Union (p);
}
if (method.cas.size > 0) {
PermissionSet p = Decode (method.cas.blob, method.cas.size);
ps = (ps == null) ? p : ps.Union (p);
}
if (method.noncas.size > 0) {
PermissionSet p = Decode (method.noncas.blob, method.noncas.size);
ps = (ps == null) ? p : ps.Union (p);
}
// in this case we union-ed the permission sets because we want to do
// a single stack walk (not up to 4).
if (ps != null)
ps.Demand ();
}