Attempt by security transparent method ‘Autofac.Integration.Mvc.RegistrationExtensions.RegisterControllers(Autofac.ContainerBuilder, System.Reflection.Assembly[])’ to access security critical type ‘Autofac.Builder.IRegistrationBuilder`3<System.Object,Autofac.Features.Scanning.ScanningActivatorData,Autofac.Builder.DynamicRegistrationStyle>’ failed.
Assembly ‘Autofac.Integration.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da’ is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
I am getting this error after upgrading Autofac from 3.5.0 to the latest version i.e, 8.0.0. Getting this security issue related to Autofac.Integration.Mvc. Checked Autofac.Integration.Mvc is a dll and unable to update that to the latest.
How can I resolve this issue?
Tried upgrading:
Autofac.MVC5: 6.0.0 – 6.1.0
Autofac.WebApi2: 6.0.0 – 6.1.1
This didn’t solve the issue.
Utkarsh Srivastava is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.