Security accessibility of the overriding method must match the security accessibility of the method being overriden

Problem

You get this error when running your application.

Security accessibility of the overriding method must match the security accessibility of the method being overriden

Solution

Add the following code to all AssemblyInfo.cs (.vb) files in your application.

Visual Basic .NET:

Imports System.Security

 

<Assembly: SecurityRules(SecurityRuleSet.Level1)>

C#:

using System.Security;

 

[assembly: SecurityRules(SecurityRuleSet.Level1)]

See Also

Part VII:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages