That assembly does not allow partially trusted callers although the zone is fully trusted.

Posted by Frederik Gheysels on Stack Overflow See other posts from Stack Overflow or by Frederik Gheysels
Published on 2010-05-27T09:50:01Z Indexed on 2010/05/27 13:21 UTC
Read the original article Hit count: 587

Filed under:
|
|

Since yesterday, I receive a security exception when I want to run a unit-test from within VS.NET 2008. The error goes like this:

SecurityException: that assembly does not allow partially trusted callers
... 
The assembly that failed was : file:///S:/MyProject/MyAssembly.dll

The S: drive is a mapped drive which points to a physical location on my disk.

What I find very strange, is that this used to work for months previously. I mean, I did this all the time. In order to get this to work, I 've created a new security zone with the caspol utility in order to give this S: network share drive FullTrust. In other words, when I run

caspol -m -lg

I see this (I removed the other zones for the sake of brevity):

1.2.  Zone - Intranet: LocalIntranet
   1.2.1.  All code: Same site Web
   1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.2.3.  Url - file://R:/*: FullTrust
   1.2.4.  Url - file://S:/*: FullTrust
   1.2.5.  Url - file:///S:/*: FullTrust

I've added the 1.2.5 zone just recently because the error that was given, mentionned file:///s:/....

Any ideas ?

Could it be that this has something to do with the installation of VS.NET 2010 or the .NET Framework version 4.0 ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET