I have a class that inherits from Exception. In .NET 4, I started receiving a runtime error:
Inheritance security rules violated while overriding m
Had this problem when I was calling an assembly that had AllowPartiallyTrustedCallers attribute:
[assembly: System.Security.AllowPartiallyTrustedCallers]
Removing it solved my problem without switching to SecurityRuleSet.Level1.