Thanks Jason. That basically confirmed what I was thinking: the framework ('System.Windows.Forms') is the reason for the exception. The next question, does anyone know of a way to union permissions in the attribute? I noticed the 'StrongNameIdentityPermission' has a method to union permissions but this is not available in the 'StrongNameIdentityPermissionAttribute' class. I'm not sure it even makes sense but am thinking that I would like to union my public key and the framework's so this exception wouldn't be thrown. Does this make sense? I'm just thinking out loud here but wouldn't it make sense to do the demand all the way up the call stack or is the 'LinkDemand' sufficient in everyone's mind? Better yet, can anyone think of a reason why I wouldn't want to do this (grant permission to the framework)?
TIA, Dave. On Fri, 12 Apr 2002 08:27:37 -0700, Jason Bock <[EMAIL PROTECTED]> wrote: > >My guess is that you're trying to instantiate myClass from a button event >or something like that. In that case, the problem is that your button's >event code is not the only caller in the stack. I reproduced your problem >on my machine by creating a class that has a method "protected" by a >strong name. When I try to create an instance of the class that contains >the method, I get the error you see, and here's the call stack: > >System.Security.SecurityException: Request for the permission of type >System.Security.Permissions.StrongNameIdentityPermission, mscorlib, >Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 >failed. > at System.Security.CodeAccessSecurityEngine.CheckTokenBasedSetHelper >(Boolean ignoreGrants, TokenBasedSet grants, TokenBasedSet denied, >TokenBasedSet demands) > at System.Security.CodeAccessSecurityEngine.CheckSetHelper >(PermissionSet grants, PermissionSet denied, PermissionSet demands) > at StrongNameDemand.SND.CallMe() > at StrongNameDemandTest.frmMain.btnCall_Click(Object sender, EventArgs >e) > at System.Windows.Forms.Control.OnClick(EventArgs e) > at System.Windows.Forms.Button.OnClick(EventArgs e) > at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) > at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons >button, Int32 clicks) > at System.Windows.Forms.Control.WndProc(Message& m) > at System.Windows.Forms.ButtonBase.WndProc(Message& m) > at System.Windows.Forms.Button.WndProc(Message& m) > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, >IntPtr wparam, IntPtr lparam) > >Since none of the methods before my btnCall_Click have the desired strong >name, it fails. If I do the same thing from a Main method in a console >app, the call succeeds. > >Regards, > >Jason > >You can read messages from the DOTNET archive, unsubscribe from DOTNET, or >subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.