-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Interoperability.CentralizePInvokesIntoNativeMethodsTypeRule(2.10)
Assembly: Gendarme.Rules.Interoperability
Version: 2.10
This rule will warn you if p/invoke declarations are found outside some specially named types. The convention makes it easier to know which type of security checks are done (at runtime) and how critical is a security audit for them. In all cases the type should not be visible (i.e. internal in C#) outside the assembly. Note that the type naming itself has no influence on security (either with Code Access Security or with CoreCLR for Silverlight). The naming convention includes the presence or absence of the SuppressUnmanagedCodeSecurity security attribute based on the type name.
- NativeMethods should not be decorated with a SuppressUnmanagedCodeSecurity. This will let CAS do a stackwalk to ensure the code can be...
- SafeNativeMethods should be decorated with a [SuppressUnmanagedCodeSecurity] attribute. The attribute means that no stackwalk will occurs.
- UnsafeNativeMethods should be decorated with a [SuppressUnmanagedCodeSecurity] attribute. The attribute means that no stackwalk will occurs. However since the p/invoke methods are named unsafe then the rule will warn an audit-level defect to review the code.
- This rule is available since Gendarme 2.8
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!