CA2122:不要间接公开具有链接要求的方法。如何在我的代码中修复它
CA2122:不要间接公开具有链接要求的方法。
我的代码如下:
public void LoadPage(Uri url)
{
webBrowser1.Url = url; //webBrowser1 is an object of WebBrowser
webBrowser1.Refresh();
}
Fxcop 产生警告“CA2122:不要间接公开具有链接要求的方法”。
为什么这个警告出现在我的代码上?
如何解决?
- 如何向我的代码授予权限以填充代码访问安全 (CAS) 属性。即我在这样的方法上有一个属性 [EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = false)]
我向我的代码授予了哪些权限以及如何获取上述属性?
CA2122: Do not indirectly expose methods with link demands.
My code is as follows:
public void LoadPage(Uri url)
{
webBrowser1.Url = url; //webBrowser1 is an object of WebBrowser
webBrowser1.Refresh();
}
Fxcop produced the warning "CA2122: Do not indirectly expose methods with link demands."
Why this warning appeared on my code?
How to fix it?
- How can I grant permission to my code to fullfill Code access security (CAS) attribute. i.e I have an attribute on a method like this
[EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = false)]
What permission I have give my code and How for above mentioned attribute?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论