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. #1419
public class ReproTest
{
[Fact]
public void Repro()
{
var builder = new ContainerBuilder();
var container = builder.Build();
Assert.NotNull(container);
}
}
If you find an issue, please do follow the issue template. Do not just paste the exception in as the title. Also, the exception is about the MVC integration, not core Autofac, so please file in the MVC repo. This repo is for core Autofac issues only.
Describe the Bug
Steps to Reproduce
Expected Behavior
Exception with Stack Trace
Dependency Versions
Autofac:
Additional Info