I must be completely blind. I can't seem to figure out why
StrongNameIdentityPermissionAttribute does not make any difference in my
project. I'm working in VS2005 with a solution that has a WinForms
project that accesses a class library (also a project in the current
solution). Neither assembly is strong-named.
When I add StrongNameIdentityPermissionAttribute to the assembly, class,
or method in my class library I get no exception.
I've yanked the public key from Accessibility.dll; so, I know there's no
way I could accidentally strong-name any assembly with this public key.
Here's what I have in my class library:
[assembly:StrongNameIdentityPermissionAttribute
(SecurityAction.RequestMinimum,
PublicKey="002400000480000094000000060200000024000" +
"052534131000400000100010007d1fa57c4aed9f0a32e84aa" +
"0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad" +
"9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc6" +
"07774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c" +
"1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4" +
"963d261c8a12436518206dc093344d5ad293")]
namespace ClassLibrary
{
[StrongNameIdentityPermissionAttribute(SecurityAction.Demand,
PublicKey = "002400000480000094000000060200000024000" +
"052534131000400000100010007d1fa57c4aed9f0a32e84aa" +
"0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad" +
"9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc6" +
"07774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c" +
"1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4" +
"963d261c8a12436518206dc093344d5ad293")]
public class Class1
{
[method: StrongNameIdentityPermissionAttribute(SecurityAction.Demand,
PublicKey = "002400000480000094000000060200000024000" +
"052534131000400000100010007d1fa57c4aed9f0a32e84aa" +
"0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad" +
"9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc6" +
"07774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c" +
"1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4" +
"963d261c8a12436518206dc093344d5ad293")]
public Class1()
{
System.Diagnostics.Debug.WriteLine(this.GetType().Name);
}
}
}
and here's the stack when a break-point in the class library is hit:
ClassLibrary.dll!ClassLibrary.Class1.Class1() Line 30 C#
FrontEnd.exe!FrontEnd.Form1.Form1() Line 13 + 0x13 bytes C#
FrontEnd.exe!FrontEnd.Program.Main() Line 17 + 0x13 bytes C#
[External Code]
I don't intend to keep all three attributes; I just kept adding them to
see if I could get an exception. I've tried various combinations of
LinkDemand and Demand on the method and the class attributes. Can anyone
see what I'm doing wrong?
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com