Nico Vuyge's blog

Taking the blue AND the red pill

URL Deployment bloopers.

Nico Vuyge

SecurityException

While writing the URL deployment test application I got an obscure error. Whenever I tried to show the form in the strong named assembly, I got a SecurityException. Debugging the application didn't help. The PermissionType member of the SecurityException, which should indicate what the security problem was, was always null. Giving my application all possible permissions (with the .NET Framework configuration tool) didn't help. Only giving my application FullTrust made the exception go away. I remembered from the PDC 2003 that there would be a tool in Whidbey to calculate the minimum permission set for an application (Permcalc). So I tried PermCalc on my application. It reports that I only need UIPermission, which is obviously not the case. It turned out that this is caused because I'm calling a strong named assembly from an unsigned assembly. Marking the strong named assembly with the assembly attribute AllowPartiallyTrustedCallersAttribute solves the problem. Because of the lack of information on the source of the SecurityException I lost a lot of time here.