Nico Vuyge's blog

Taking the blue AND the red pill

Nico Vuyge

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.

View Nico Vuyge's profile on LinkedIn Nico Vuyge is a freelance software developer in East-Flanders (Belgium), specializing in Microsoft technologies. Nico has fully embraced managed software development in C# after a decade of software development in the unmanaged world in C++.
Apart from his interests in state-of-the-art managed software development, he is also interested in the hardware aspects of informatics, in particular performance and silent computing related aspects. For more details, see our company history , or contact him directly at nicov@iconstructions.be.
Microsoft Tag for Nico Vuyge