I am confused about what I need to do in order to correctly "set up" my unverifiable method so that it conforms to code access security guidelines.
Given the following method
[MethodImpl(MethodImplOptions.ForwardRef)]
private extern void DoStuffUnverifiable();
which is deemed unverifiable by PEVerify
, what attributes do I absolutely need to apply to the method definition?
[SecurityCritical]
?[SecuritySafeCritical]
?
How do I decide between those two? Further,
- do I need to set
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
? - If so, do I use
SecurityAction.Demand
or something else?
Are there any other attributes I definitely need to apply? Are there any that I could apply, although not neccessary?