Skip to content

[4.9.3] OutputCacheAttribute causing issues  #1013

@xyanide

Description

@xyanide

After updating to 4.9.3 (from 4.9.2) i'm getting the following error on controller actions with the output cache attribute:
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]

The error thrown is:

[ArgumentException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.]   
System.Reflection.RuntimeMethodInfo.CreateDelegateInternal(Type delegateType, Object firstArgument, DelegateBindingFlags bindingFlags, StackCrawlMark& stackMark) +14797604
   System.Reflection.RuntimeMethodInfo.CreateDelegate(Type delegateType) +43
   Autofac.Core.Activators.Reflection.AutowiringPropertyInjector.MakeFastPropertySetter(PropertyInfo propertyInfo) in C:\projects\autofac\src\Autofac\Core\Activators\Reflection\AutowiringPropertyInjector.cs:141
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +87
   Autofac.Core.Activators.Reflection.AutowiringPropertyInjector.InjectProperties(IComponentContext context, Object instance, IPropertySelector propertySelector, IEnumerable`1 parameters) in C:\projects\autofac\src\Autofac\Core\Activators\Reflection\AutowiringPropertyInjector.cs:98
   Autofac.ResolutionExtensions.InjectProperties(IComponentContext context, TService instance) in C:\projects\autofac\src\Autofac\ResolutionExtensions.cs:59
   Autofac.Integration.Mvc.AutofacFilterProvider.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +191
   System.Web.Mvc.FilterProviderCollection.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +165
   System.Web.Mvc.ControllerActionInvoker.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +55
   System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +243
   System.Web.Mvc.<>c.<BeginExecuteCore>b__152_0(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +45
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +789
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +633
   System.Web.Mvc.<>c.<BeginProcessRequest>b__20_0(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +99
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +544
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1122
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131

Reverting to 4.9.2 fixes the issue.
My autofac dependencies are:

id="Autofac" version="4.9.3"
id="Autofac.Mvc5" version="4.0.2"
id="Autofac.Mvc5.Owin" version="4.0.1"
id="Autofac.Owin" version="4.2.0"
.NET 4.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions