FxCop: a LinkDemand Error, I fixed it but Don't understand the sol

C

Chris Mohan

HI,
I recently scanned an assembly with FXCOP and got this error in the report:
"Virtual methods and their overrides require the same LinkDemand status." I
fixed it.. but would like to know what others think of myt solution. re:the
class in the assembly inherits from the textbox control in
system.web.ui.webcontrols. My code overRides the base classes
addAttributesToRender method.

So, i fixed it by firing up Reflector and copying the linkdemand used within
the framework's webcontrol class's addAttriburtesToRender method. That
worked...on the next scan FX cop was happy. So, the link demand is unusual
looking to me .. it looks like it dynamically catches the caller's security
policy at run time.

Can anyone think of a reason why I shouldn't use the following declarative
security? What does it do? (I've used CAS before but the snippet below is
pretty complex looking.) All i know is that FXCOP stopped reporting the
error. Thanks!


<PermissionSet(SecurityAction.LinkDemand, Xml:=" _
<PermissionSet class=""System.Security.PermissionSet""" & ChrW(13) & _
ChrW(10) & " version=""1"">" & ChrW(13) & ChrW(10) & " _
<IPermission class=""System.Web.AspNetHostingPermission, System, _
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089""" & _
ChrW(13) & ChrW(10) & " version=""1""" & ChrW(13) & ChrW(10) _
& " Level=""Minimal""/>" & ChrW(13) & ChrW(10) _
& "</PermissionSet>" & ChrW(13) & ChrW(10)), _
PermissionSet (SecurityAction.InheritanceDemand, _
Xml:="<PermissionSet class=""System.Security.PermissionSet""" & ChrW(13) _
& ChrW(10) & " version=""1"">" & ChrW(13) & ChrW(10) & " _
<IPermission class=""System.Web.AspNetHostingPermission, System, _
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089""" & _
ChrW(13) & ChrW(10) & " version=""1""" & ChrW(13) & _
ChrW(10) & " Level=""Minimal""/>" & ChrW(13) & ChrW(10) _
& "</PermissionSet>" & ChrW(13) & ChrW(10))> _
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top