what does this security warning mean (.Net Process class)?

后端 未结 2 1972
深忆病人
深忆病人 2021-01-05 13:53

I am using VSTS 2008 + .Net 2.0 + C#. And I am running Code Analysis after build. I got the following confusing security warning. Here is the warning and related code, any i

相关标签:
2条回答
  • 2021-01-05 14:13

    More information about security warnings and CA2122 - Do not indirectly expose methods with link demands

    0 讨论(0)
  • 2021-01-05 14:34

    Your method calls Foo that calls into a Process.Start which is protected by a link demand for Full Trust. In order to avoid the problem that FxCop is warning you about, you should add a link demand or full demand for the same permissions to your method.

    You can fix it by adding to your method

    [PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
    

    See http://msdn.microsoft.com/en-us/library/970x52db.aspx

    0 讨论(0)
提交回复
热议问题