-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Security.Cas.ReviewSealedTypeWithInheritanceDemandRule(2.10)
Sebastien Pouliot edited this page Jan 22, 2011
·
2 revisions
Assembly: Gendarme.Rules.Security.Cas
Version: 2.10
This rule checks for sealed types that have InheritanceDemand declarative security applied to them. Since those types cannot be inherited from the InheritanceDemand will never be executed by the runtime. Check if the permission is required and, if so, change the SecurityAction to the correct one. Otherwise remove the permission.
Bad example:
[SecurityPermission (SecurityAction.InheritanceDemand, Unrestricted = true)]
public sealed class Bad {
}
Good example (non sealed):
[SecurityPermission (SecurityAction.InheritanceDemand, Unrestricted = true)]
public class Good {
}
Good example (LinkDemand):
[SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)]
public sealed class Good {
}
- Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security and named SealedTypeWithInheritanceDemandRule.
Note that this page was autogenerated (3/17/2011 9:31:58 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!