1
Vote

System.TypeLoadException: Inheritance security rules violated while overriding member:

description

Running bootstrapper causes problem.

nheritance security rules violated while overriding member: 'MySql.Data.Entity.MySqlConnectionFactory.CreateConnection(System.String)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Inheritance security rules violated while overriding member: 'MySql.Data.Entity.MySqlConnectionFactory.CreateConnection(System.String)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[TypeLoadException: Inheritance security rules violated while overriding member: 'MySql.Data.Entity.MySqlConnectionFactory.CreateConnection(System.String)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +49
Bootstrap.Extensions.Containers.RegistrationHelper.GetTypesImplementing(Assembly assembly) +25
Bootstrap.Extensions.Containers.<>c__DisplayClass91.<GetInstancesOfTypesImplementing>b__7(Assembly a) +70
System.Collections.Generic.List
1.ForEach(Action`1 action) +13926536
Bootstrap.Extensions.Containers.RegistrationHelper.GetInstancesOfTypesImplementing() +219
Bootstrap.AutoMapper.AutoMapperExtension.Run() +104
Bootstrap.Bootstrapper.Start() +142
projectname.Web.Infrastructure.AutoBootStrapper.Run() in c:\Users\path\Documents\Visual Studio 2013\Projects\projectname.Web\projectname.Web\Infrastructure\AutoBootStrapper.cs:22
projectname.Web.WebApiApplication.Application_Start() in c:\Users\path\Documents\Visual Studio 2013\Projects\projectname.Web\projectname.Web\Global.asax.cs:27

[HttpException (0x80004005): Inheritance security rules violated while overriding member: 'MySql.Data.Entity.MySqlConnectionFactory.CreateConnection(System.String)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12584905
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Inheritance security rules violated while overriding member: 'MySql.Data.Entity.MySqlConnectionFactory.CreateConnection(System.String)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12601936
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12441597

comments

luisbocaletti wrote Jun 6, 2014 at 3:10 AM

Hi kwells,

I don't think the issue is caused by Bootstrapper. I think you might have an issue with a class that is overriding the CreateConnection method. It just so happen that is discovered at startup time. At least thats my theory.

Have you seen this question ?
http://stackoverflow.com/questions/3055792/inheritance-security-rules-violated-while-overriding-member-securityruleset-le