Closed GoogleCodeExporter closed 8 years ago
Thanks very much for the report and repro - I think we can fix this fairly
easily on the Autofac side of things by using DependencyResolver.Current in
GetFilters() (calling through Glimpse is probably the right thing to do.) Time
is a little tight right now but should be able to get this into the next
release.
Original comment by nicholas...@gmail.com
on 23 Jan 2012 at 5:29
The Glimpse team will also look into cleaning this up on our side if possible.
Thank you for the excellent bug report.
Original comment by nikm...@gmail.com
on 10 Feb 2012 at 9:33
I ran into this issue as well. I just wanted to call out a couple of
workarounds. First, the simplest, is to blacklist the Execution Glimpse plugin
since this is the one that wrappers the DependencyResolver. In your Glimpse
config:
<glimpse enabled="true">
<pluginBlacklist>
<add plugin="Glimpse.Mvc3.Plugin.Execution" />
</pluginBlacklist>
</glimpse>
This allows you to continue using all the other Glimpse features, you just miss
out on the Execution tab and the Controller/ActionFilter integration with the
Timeline tab.
If you want to go crazy and get it working no matter what it takes, there are
quite a few hoops to jump through.
1) You must create a custom build of Glimpse that doesn't do an ILMerge with
Castle.Core (edit their default.ps1 merge task and remove Castle.Core from line
43), or simply do a Release solution build and reference the Glimpse.Mvc3.dll
in your MVC application directly. See this bug for more detail on why this is
required: https://github.com/Glimpse/Glimpse/issues/159
2) Install the Castle.Core NuGet package. I went with 2.5.2 since that's what
both Glimpse and AutofacContrib.DynamicProxy use.
3) Add the attached GlimpseExecutionPlugin file to your solution which is
simply the Execution plugin internal classes copied out of the Glimpse solution
and made public (don't have to make them public).
4) When registering your controllers with Autofac, set the ActionInvoker
OnActivating using the Glimpse extension method TrySetActionInvoker (included
in one of the copied classes).
I already had a custom build of Glimpse in order to get some bug fixes sooner,
so it wasn't much extra effort for me to get this working in my application.
But it may be a high price if you don't already have a custom build.
Here's the code to set the action invoker:
builder.RegisterControllers(ThisAssembly).OnActivating(TrySetActionInvoker);
...
private void TrySetActionInvoker(IActivatingEventArgs<object> e)
{
((IController) e.Instance).TrySetActionInvoker();
}
Original comment by scull...@gmail.com
on 10 Feb 2012 at 10:47
Attachments:
Hi! Anyone know what the update is on this one? Cheers.
Original comment by andrewdu...@gmail.com
on 31 May 2012 at 6:49
Did this ever get fixed? I've just hit exactly the same issue using
Autofac.2.6.3.862 (this is the NuGet version). The fix outlined above (removing
the Execution Plugin has worked) but I'm wondering if there's a planned release
date for the fix.
Thanks
Original comment by kev.r.jo...@gmail.com
on 5 Aug 2012 at 7:43
I tried the workaround (removing execution) and it did NOT work.
Original comment by sean.hed...@gmail.com
on 7 Aug 2012 at 5:33
Original comment by travis.illig
on 21 Sep 2012 at 4:34
Adding some indirection around AutofacDependencyResolver.Current seems to fix
the issue.
Original comment by travis.illig
on 13 Dec 2012 at 5:49
Original comment by travis.illig
on 13 Dec 2012 at 5:49
I think I have this fixed, but in order to do it there were a couple of design
changes that had to happen in the MVC integration.
* The AutofacDependencyResolver now registers itself on the fly with the
request lifetime scope. AutofacDependencyResolver.Current can now be retrieved
by using DependencyResolver.Current.GetService<AutofacDependencyResolver>(),
allowing systems like Glimpse to wrap/proxy but still allowing ADR.C to work
right.
* The ILifetimeScopeProvider interface changed to allow GetLifetimeScope to
take a configuration action. This allows the AutofacDependencyResolver to build
that registration of itself on the fly and configure the request scope.
* The RequestLifetimeScopeProvider no longer holds a reference to its own
configuration action. Since the actual request lifetime scope initiation is
done through the AutofacDependencyResolver and the general use case is that ADR
just passed the configuration action through to the lifetime scope provider, it
didn't make sense that the lifetime scope provider be the "owner" for that. It
also didn't allow other lifetime scope provider implementations to make use of
that configuration action. Instead, the ADR is now the owner of the
configuration action and it uses the ILifetimeScopeProvider.GetLifetimeScope
method, passing in the configuration action as needed.
That interface change is a breaking one for people implementing custom request
lifetime providers, but for the majority case this should be seamless.
Original comment by travis.illig
on 13 Dec 2012 at 7:18
This issue was closed by revision e553f3cd3ecd.
Original comment by travis.illig
on 13 Dec 2012 at 7:26
I've just found this issue on the latest version of Autofac (3.1.1.0). As soon
as I added Glimpse (Core=1.5.0.0, AspNet=1.3.1.0, Mvc4=1.3.2.0) to my project I
got the following error message:
Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to
an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
Autofac.Integration.Mvc.AutofacFilterAttributeFilterProvider.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +49
System.Web.Mvc.<>c__DisplayClass9.<GetFilters>b__6(IFilterProvider fp) +19
System.Linq.<SelectManyIterator>d__14`2.MoveNext() +234
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
System.Linq.<GetEnumerator>d__0.MoveNext() +110
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
System.Linq.<ReverseIterator>d__a0`1.MoveNext() +92
System.Web.Mvc.<RemoveDuplicates>d__b.MoveNext() +114
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
System.Linq.<ReverseIterator>d__a0`1.MoveNext() +92
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +85
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +381
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
System.Web.Mvc.FilterInfo..ctor(IEnumerable`1 filters) +289
System.Web.Mvc.ControllerActionInvoker.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +46
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +123
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +23
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9630364
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.17929
Original comment by rodolfog...@gmail.com
on 22 Jul 2013 at 12:28
I've added a new issue for the new failure - Issue #451 - since this issue is
around MVC3 support (which was fixed) and the new issue, while related to
Glimpse, has a different root cause/different failure going on.
Original comment by travis.illig
on 22 Jul 2013 at 4:15
Original issue reported on code.google.com by
jrnai...@gmail.com
on 29 Dec 2011 at 8:40Attachments: