Linker Tools Warning LNK4251

AllowPartiallyTrustedCallersAttribute assembly attribute used without specifying /CLRUNMANAGEDCODECHECK

If you use AllowPartiallyTrustedCallersAttribute in your code, you should explicitly set /CLRUNMANAGEDCODECHECK. It is a potential security vulnerability if an image contains both the SuppressUnmanagedCodeSecurity and AllowPartiallyTrustedCallers attributes.

For more information, see /CLRUNMANAGEDCODECHECK (Add SupressUnmanagedCodeSecurityAttribute).

Example

The following sample generates LNK4251.

// LNK4251.cpp
// compile with: /clr /LD /W1
// LNK4251 expected
[assembly:System::Security::AllowPartiallyTrustedCallersAttribute];