C ++ / CLI:CA2123:需要SecurityCriticalAttribute? [英] C++/CLI: CA2123: Requires SecurityCriticalAttribute?

查看:206
本文介绍了C ++ / CLI:CA2123:需要SecurityCriticalAttribute?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这样的错误有点失落:


警告7 CA2123:Microsoft.Security
:添加以下内容安全属性

'RithmicConnector :: Connect(String ^)'
为了匹配基于
上的LinkDemand方法'IConnector :: Connect(String ^)':
'SecurityCriticalAttribute'。 c:\work\\\
ettecture\tradex\source\tradex.connectivity.rithmic\rithmicconnector.cpp 52 Tradex.Connectivity.Rithmic


我在哪里添加SecurityCriticalAttribute?



我试过在头文件 - 但是错误不会消失。我有一个很大的一个(托管C ++)接口DLL的每个暴露的方法。



我想让CA运行。

$ b $

解决方案

div>

您必须执行两项操作:



  1. 将[SecurityCritical]属性添加到包含关键代码的特定方法(或您想要装饰的任何其他方法)。

以下是可能有帮助的博客条目使用透明度在CLR


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

解决方案

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

这篇关于C ++ / CLI:CA2123:需要SecurityCriticalAttribute?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆