.NET 4, AllowPartiallyTrustedCallers attribute, and security markings like SecurityCritical
问题 I'm new C# and am trying to understand the new security features of .NET-4. To fill in some details, I'm currently trying to update AutofacContrib.Moq to work with the latest Moq. I had no problems doing this for .NET-3.5 and under. But in .NET-4 the security restrictions result in numerous security exceptions. Moq has a a single method, GetObjectData , that's marked with the SecurityCritical attribute. AutofacContrib.Moq has the AllowPartiallyTrustedCallers attribute set which is the source