Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++/CLI: CA2123: Requires SecurityCriticalAttribute?

I am a little lost on erros like that:

Warning 7 CA2123 : Microsoft.Security : Add the following security attribute to 'RithmicConnector::Connect(String^)' in order to match a LinkDemand on base method 'IConnector::Connect(String^)': 'SecurityCriticalAttribute'. c:\work\nettecture\tradex\source\tradex.connectivity.rithmic\rithmicconnector.cpp 52 Tradex.Connectivity.Rithmic

Where do I add the SecurityCriticalAttribute?

I tried on the header file - but the error does not disappear. I have one of those pretty much on every exposed method of a (managed C++) interface DLL.

And I want CA to run through.

How do I fix those?

Regards

like image 841
TomTom Avatar asked Apr 19 '10 19:04

TomTom


1 Answers

You'll have to do two things:

  1. Add [assembly: SecurityCritical] to the assembly.
  2. Add [SecurityCritical] attribute to the specific methods containing critical code(or whatever else you wish to decorate).

Here's a blog entry that might be helpful Using Transparency in CLR

like image 58
BigBrother Avatar answered Nov 04 '22 06:11

BigBrother