Error when installing a new module

Topics: Customizing Orchard, Troubleshooting
Dec 12, 2014 at 9:30 PM
I tried installing a module and got this error when enabling it and can't seem to get anything working now, please help.

[InvalidOperationException: ValueFactory attempted to access the Value property of this instance.]
System.Lazy1.CreateValue() +416
System.Lazy
1.LazyInitValue() +152
System.Lazy1.get_Value() +75
Orchard.Logging.OrchardLog4netLogger.AddExtendedThreadInfo() in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\OrchardLog4netLogger.cs:63
Orchard.Logging.OrchardLog4netLogger.Error(String message, Exception exception) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\OrchardLog4netLogger.cs:175
Orchard.Logging.CastleLogger.Log(LogLevel level, Exception exception, String format, Object[] args) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\CastleLogger.cs:45
Orchard.Logging.LoggingExtensions.FilteredLog(ILogger logger, LogLevel level, Exception exception, String format, Object[] objects) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\LoggingExtensions.cs:71
Orchard.Logging.LoggingExtensions.Error(ILogger logger, Exception exception, String message) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\LoggingExtensions.cs:31
Orchard.Environment.DefaultOrchardHost.<CreateAndActivateShells>b__7(ShellSettings settings) in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:139
System.Threading.Tasks.<>c__DisplayClass21
2.<ForEachWorker>b__17(Int32 i) +22
System.Threading.Tasks.<>c__DisplayClassf1.<ForWorker>b__c() +910
System.Threading.Tasks.Task.InnerInvoke() +72
System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) +17
System.Threading.Tasks.<>c__DisplayClass11.<ExecuteSelfReplicating>b__10(Object param0) +198

[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3834425
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +10919077
System.Threading.Tasks.Task.Wait() +10
System.Threading.Tasks.Parallel.ForWorker(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action
1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) +925
System.Threading.Tasks.Parallel.ForEachWorker(TSource[] array, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) +216
System.Threading.Tasks.Parallel.ForEachWorker(IEnumerable
1 source, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) +10893112
System.Threading.Tasks.Parallel.ForEach(IEnumerable
1 source, Action1 body) +110
Orchard.Environment.DefaultOrchardHost.CreateAndActivateShells() in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:133
Orchard.Environment.DefaultOrchardHost.BuildCurrent() in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:106
Orchard.Environment.DefaultOrchardHost.GetShellContext(ShellSettings shellSettings) in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:65
Orchard.Logging.OrchardLog4netLogger.LoadSettings() in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\OrchardLog4netLogger.cs:53
System.Lazy
1.CreateValue() +180
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22
System.Lazy1.get_Value() +11212537
Orchard.Logging.OrchardLog4netLogger.AddExtendedThreadInfo() in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\OrchardLog4netLogger.cs:63
Orchard.Logging.OrchardLog4netLogger.Error(String message, Exception exception) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\OrchardLog4netLogger.cs:175
Orchard.Logging.CastleLogger.Log(LogLevel level, Exception exception, String format, Object[] args) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\CastleLogger.cs:45
Orchard.Logging.LoggingExtensions.FilteredLog(ILogger logger, LogLevel level, Exception exception, String format, Object[] objects) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\LoggingExtensions.cs:71
Orchard.Logging.LoggingExtensions.Error(ILogger logger, Exception exception, String message) in f:\inetpub\FPS Gold Orchard\src\Orchard\Logging\LoggingExtensions.cs:31
Orchard.Environment.DefaultOrchardHost.<CreateAndActivateShells>b__7(ShellSettings settings) in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:139
System.Threading.Tasks.<>c__DisplayClass21
2.<ForEachWorker>b__17(Int32 i) +22
System.Threading.Tasks.<>c__DisplayClassf1.<ForWorker>b__c() +910
System.Threading.Tasks.Task.InnerInvoke() +72
System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) +17
System.Threading.Tasks.<>c__DisplayClass11.<ExecuteSelfReplicating>b__10(Object param0) +198

[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3834425
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +10919077
System.Threading.Tasks.Task.Wait() +10
System.Threading.Tasks.Parallel.ForWorker(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action
1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) +925
System.Threading.Tasks.Parallel.ForEachWorker(TSource[] array, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) +216
System.Threading.Tasks.Parallel.ForEachWorker(IEnumerable
1 source, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) +10893112
System.Threading.Tasks.Parallel.ForEach(IEnumerable
1 source, Action1 body) +110
Orchard.Environment.DefaultOrchardHost.CreateAndActivateShells() in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:133
Orchard.Environment.DefaultOrchardHost.BuildCurrent() in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:106
Orchard.Environment.DefaultOrchardHost.BeginRequest() in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:229
Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.BeginRequest() in f:\inetpub\FPS Gold Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:80
Orchard.Web.MvcApplication.HostBeginRequest(HttpApplication application, IOrchardHost host) in f:\inetpub\FPS Gold Orchard\src\Orchard.Web\Global.asax.cs:38
Orchard.WarmupStarter.Starter
1.OnBeginRequest(HttpApplication application) in f:\inetpub\FPS Gold Orchard\src\Orchard.WarmupStarter\Starter.cs:68
Orchard.Web.MvcApplication.Application_BeginRequest() in f:\inetpub\FPS Gold Orchard\src\Orchard.Web\Global.asax.cs:29

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +155
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +56
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Developer
Dec 13, 2014 at 12:41 PM
Does this happen with any module, or just a specific one? If so, which module?
Does the issue go away when you remove the installed module?
Dec 13, 2014 at 6:18 PM
So far it's happened with two custom modules that I built. I installed the same modules on other instances of Orchard without a problem but for some reason I get this error once in a while. The only way to fix the error appears to be an iisreset as I cannot get into the site otherwise and the module enabled fine once I reset iis. Just wondering what might be causing the error.
Developer
Dec 14, 2014 at 6:02 PM
I see. I'm afraid it's impossible to tell without more information. I have seen this error happen once before with my own module, and the cause was a bug with my code that would normally cause a stack overflow exception due to circular method invocations, but because the Lazy<T> class was involved, I received the error you're seeing as well. If possible, try and replace your Lazy<T> with T and see if you're getting a SO exception.
Alternatively, start by attaching a debugger and inspect the state of your program when the error occurs.
Dec 15, 2014 at 12:54 AM
I do have some code using the Lazy Loader and Lazy<T> that I'm not actually utilizing in my module. I'll try removing the unused code and see what happens, thank you.