I am having the following issue with a custom attribute I've created. I have
inherited from CodeAccessSecurityAttribute and I receive this error:



C:\Custom\TestCustomPrincipal\TestSecuredObject.cs(23): Error emitting
XASecurityPermissionAttribute' attribute -- 'Failed to load assembly
Framework.Security -- System.IO.FileNotFoundException: File or assembly name
Framework.Security, or one of its dependencies, was not found.

File name: Framework.Security"



=== Pre-bind state information ===

LOG: DisplayName = SXA.Framework.Security, Version=1.0.1.0, Culture=neutral,
PublicKeyToken=711ad20b5887b5ae

 (Fully-specified)

LOG: Appbase = C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE

LOG: Initial PrivatePath = NULL

Calling assembly : (Un'





Now I have as you can see strong named the assembly which does not affect
the error either way. I have defined my class as follows:



      [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Class)]

      [Serializable()] sealed public class XASecurityPermissionAttribute :
CodeAccessSecurityAttribute

      {

            private RequestType _requestType = RequestType.None;



            public XASecurityPermissionAttribute(SecurityAction action) :
base(action)

            {



            }



            public RequestType RequestTypeCheck

            {

                  get

                  {

                        return(_requestType);

                  }

                  set

                  {

                        _requestType = value;

                  }

            }



            public override IPermission CreatePermission()

            {

                  return new XAPermission();

            }

      }





The error comes when I apply the attribute as follows.





[XASecurityPermission(SecurityAction.Deny ,
RequestTypeCheck=RequestType.CreateModifyOwn | RequestType.ModifyElse)]

public void SetX(int value)

{

      _val = value;

}



I get the error for every application. I have attempted modifying the
IPermission that gets returned and that is to no avail.

I've also checked and yes the file exists :-) The project doesn't reference
anything other than the mscorlib and System.dll.





Thanks in advance,



Damon Squires

MCSD.NET MCDBA MCAD SCJP

0x2B || ~0x2B




===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to