Am I correct that if I need maximum performance, and I have trusted library I should just set SuppressUnmanagedCodeSecurity attribute to all Dll imports I have?
I.e. convert such import:
[DllImport("srl.dll", CharSet = CharSet.Ansi)]
private static extern string ErrorMsg(int ErrCode);
to such import:
[DllImport("srl.dll", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity]
private static extern string ErrorMsg(int ErrCode);
everywhere.
Are there any reasons not to set SuppressUnmanagedCodeSecurity?