I ve been working on understanding Code Access Security and I was hoping somebody might be able to explain to me this behavior and why it requires added permissions. Say I have two extension methods
public static string dib(this string source)
{
return souce.dob();
}
public static string dob(this string source)
{
return source+"dob":
}
If these two methods appear in the same class they require no special CAS permissions. However as soon as I move dob into another class I require System.Security.Permissions.SecurityPermission with the ControlEvidence flag. Is there some restriciton on calling extension methods from within extension methods between classes? Is there a workaround other than merging all extensions into a huge single class?
Edit: As it turns out the actual problem was not extension method related. There was a constructor which used a RegEx in one of the classes. Regexes, along with other functions which are compiled at runtime, require ControlEvidence. Thanks for your help, this CAS stuff is very tricky.