Thursday, December 19, 2013

Type Load exception was unhandled Inheritance security rules violated by type: 'System.Web.Mvc.CompareAttribute'. Derived types must either match the security accessibility of the base type or be less accessible

We tried to set the [assembly: SecurityRules(SecurityRuleSet.Level1)] attribute in both the Service library and Windows application, but we are still hitting the TypeLoadException. We are using the Service library in our MVC Web application and there's no such exception thrown (not even first-chance exception).

Solution

Run the application without debug.