I know that .NET 4 introduces a new security model but, to be honest,
I'm not sure how it affects or changes the need/use of
AllowPartiallyTrustedCallersAttribute.
The reason I bring it up is that I have reasonably common conflicts
when testing with coverage in .NET 4 against assemblies that have
APTCA on them. I blogged about it here:
http://www.paraesthesia.com/archive/2010/06/04/verificationexception-during-coverage-check-your-security-attributes.aspx
Basically, the problem is that assemblies that have APTCA on them
in .NET 4 seem to cause an exception when consuming those assemblies
and running unit tests involving code coverage. (The tests run fine
WITHOUT coverage, but when instrumented, problems occur.)
System.Security.VerificationException : Operation could destabilize
the runtime.
I've found that removing the APTCA from the assembly seems to fix the
issue, at least for the tests.
I'm working with the 2.3.1.530 .NET 4 versions of Autofac/Contrib and
I'm starting to get unit test issues in CI with them. Just
constructing one of the objects in the library (e.g., "new
ContainerBuilder()") causes it in seemingly random places.
I'm going to try building a local copy of the assemblies and test the
theory, but I didn't know if anyone else had seen the issue or not.