CA2122: Do not indirectly expose methods with references. How to fix this in my code

CA2122: Do not indirectly expose methods with references.

My code is as follows:

public void LoadPage(Uri url)
{
    webBrowser1.Url = url;    //webBrowser1 is an object of WebBrowser
    webBrowser1.Refresh();
}

Fxcop issued the warning "CA2122: Do not indirectly expose methods with references."

  • Why did this warning appear in my code?

  • How to fix it?

  • How can I grant permission to my code for the full security access code (CAS) attribute. ie I have an attribute for a method like this [EnvironmentPermissionAttribute (SecurityAction.LinkDemand, Unrestricted = false)]

What permission do I have for my code and how for the above attribute?

+3
source share

Source: https://habr.com/ru/post/1738435/


All Articles