Cannot access a disposed object (1.1 upgrade)

Topics: Troubleshooting
Apr 12, 2011 at 11:40 AM

What happened here was that while I was upgrading the various modules in the Updates tab, I fired up a second instance of WebMatrix in order to work on another site at the same time (since it was taking ages to do all the updates).

Unfortunately WebMatrix has this nasty habit of stopping other website that are already running when you do this.

So Orchard was halfway through updating a module (I think it was Search) when the webserver shut down.

Once I fired it up again I now get the following error whatever Url I attempt to access:

Server Error in '/' Application.

Cannot access a disposed object.
Object name: 'This resolve operation has already ended. When registering components using lambdas, the IComponentContext 'c' parameter to the lambda cannot be stored. Instead, either resolve IComponentContext again from 'c', or resolve a Func<> based factory to create subsequent components from.'.

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.ObjectDisposedException: Cannot access a disposed object.
Object name: 'This resolve operation has already ended. When registering components using lambdas, the IComponentContext 'c' parameter to the lambda cannot be stored. Instead, either resolve IComponentContext again from 'c', or resolve a Func<> based factory to create subsequent components from.'.

Source Error: 

Line 18:                 var error = _error;
Line 19: LaunchStartupThread(registrations);
Line 20: throw error;
Line 21: }
Line 22:


Source File: g:\Downplay\Orchard\OrchardDevTip\src\Orchard.Startup\Starter.cs    Line: 20 

Stack Trace: 

[ObjectDisposedException: Cannot access a disposed object.
Object name: 'This resolve operation has already ended. When registering components using lambdas, the IComponentContext 'c' parameter to the lambda cannot be stored. Instead, either resolve IComponentContext again from 'c', or resolve a Func<> based factory to create subsequent components from.'.]
Orchard.WarmupStarter.Starter.OnBeginRequest(HttpContext context, Action`1 registrations) in g:\Downplay\Orchard\OrchardDevTip\src\Orchard.Startup\Starter.cs:20
Orchard.Web.MvcApplication.Application_BeginRequest() in g:\Downplay\Orchard\OrchardDevTip\src\Orchard.Web\Global.asax.cs:24

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +57
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

Apr 12, 2011 at 11:55 AM

Actually, I should note that I'd updated to the "Upgraded Libs" branch so I guess this could be causing problems.

What's weird is even after deleting the App_Data folder I'm still getting the error.

To be honest I'm just going to wipe this instance and start afresh anyway.