OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

A delegate registered to create instances of 'System.Web.HttpContextBase' returned null. #5368

Open shaunluttin opened 9 years ago

shaunluttin commented 9 years ago

I'm receiving this error when running help commands. It's a pull from OrchardCMS 1.9.x that successfully builds in Visual Studio 2015 on Windows 8.1. Here is the full error message:

orchard> help commands

Error executing command "help commands"
--------------------------------------------------------------------------------

A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.

Exception Details: Autofac.Core.DependencyResolutionException: A delegate registered to create instances of 'System.Web.
HttpContextBase' returned null.

Stack Trace:

[DependencyResolutionException: A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.
]
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 param
eters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 p
arameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentCont
ext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 param
eters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 param
eters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 p
arameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentCont
ext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 param
eters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 param
eters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponen
tRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Features.LazyDependencies.LazyRegistrationSource.<>c__DisplayClass5`1.<>c__DisplayClass7.<CreateLazyRegist
ration>b__4()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Orchard.ContentManagement.DefaultContentManager.get_Handlers() in C:\Users\BigFont\Documents\GitHub\orchard-cms-mo
dules-and-themes\src\Orchard\ContentManagement\DefaultContentManager.cs:line 81
   at Orchard.ContentManagement.DefaultContentManager.New(String contentType) in C:\Users\BigFont\Documents\GitHub\orcha
rd-cms-modules-and-themes\src\Orchard\ContentManagement\DefaultContentManager.cs:line 102
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in C:\User
s\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\ContentManagement\DefaultContentManager.cs:line 22
7
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in C:\Users\BigFont\Document
s\GitHub\orchard-cms-modules-and-themes\src\Orchard\ContentManagement\DefaultContentManager.cs:line 131
   at Orchard.ContentManagement.DefaultContentQuery.<Slice>b__26_0(ContentItemVersionRecord x) in C:\Users\BigFont\Docum
ents\GitHub\orchard-cms-modules-and-themes\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 193
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Orchard.Utility.Extensions.ReadOnlyCollectionExtensions.ToReadOnlyCollection[T](IEnumerable`1 enumerable) in C:\Us
ers\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\Utility\Extensions\ReadOnlyCollectionExtensions.
cs:line 8
   at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in C:\Users\BigFont\Documents\GitHub\
orchard-cms-modules-and-themes\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 191
   at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.List() in
C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\ContentManagement\DefaultContentQuery.cs:li
ne 292
   at Orchard.Core.Settings.Services.SiteService.<GetSiteSettings>b__7_0(AcquireContext`1 ctx) in C:\Users\BigFont\Docum
ents\GitHub\orchard-cms-modules-and-themes\src\Orchard.Web\Core\Settings\Services\SiteService.cs:line 28
   at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modul
es-and-themes\src\Orchard\Caching\Cache.cs:line 57
   at Orchard.Caching.Cache`2.AddEntry(TKey k, Func`2 acquire) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-
and-themes\src\Orchard\Caching\Cache.cs:line 27
   at Orchard.Caching.Cache`2.<>c__DisplayClass3_0.<Get>b__0(TKey k) in C:\Users\BigFont\Documents\GitHub\orchard-cms-mo
dules-and-themes\src\Orchard\Caching\Cache.cs:line 19
   at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateVa
lueFactory)
   at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and
-themes\src\Orchard\Caching\Cache.cs:line 17
   at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2 acquire) in C:\Users\BigFont\Documents\GitH
ub\orchard-cms-modules-and-themes\src\Orchard\Caching\DefaultCacheManager.cs:line 33
   at Orchard.Core.Settings.Services.SiteService.GetSiteSettings() in C:\Users\BigFont\Documents\GitHub\orchard-cms-modu
les-and-themes\src\Orchard.Web\Core\Settings\Services\SiteService.cs:line 27
   at Orchard.Settings.CurrentSiteWorkContext.Get[T](String name) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modul
es-and-themes\src\Orchard\Settings\CurrentSiteWorkContext.cs:line 13
   at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7_0`1.<FindResolverForState>b__0(IWorkContextStateP
rovider wcsp) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\Environment\WorkContextImp
lementation.cs:line 32
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Orchard.Environment.WorkContextImplementation.FindResolverForState[T](String name) in C:\Users\BigFont\Documents\G
itHub\orchard-cms-modules-and-themes\src\Orchard\Environment\WorkContextImplementation.cs:line 32
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in C:\Users\BigFont\Documents\GitHub\orchar
d-cms-modules-and-themes\src\Orchard\Environment\WorkContextImplementation.cs:line 27
   at Orchard.WorkContext.get_CurrentSite() in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orch
ard\WorkContext.cs:line 50
   at Orchard.Localization.Services.SiteCultureSelector.GetCulture(HttpContextBase context) in C:\Users\BigFont\Document
s\GitHub\orchard-cms-modules-and-themes\src\Orchard\Localization\Services\SiteCultureSelector.cs:line 13
   at Orchard.Localization.Services.CurrentCultureWorkContext.<>c__DisplayClass4_0.<GetCurrentCulture>b__0(ICultureSelec
tor c) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\Localization\Services\CurrentCult
ureWorkContext.cs:line 29
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Orchard.Localization.Services.CurrentCultureWorkContext.GetCurrentCulture() in C:\Users\BigFont\Documents\GitHub\o
rchard-cms-modules-and-themes\src\Orchard\Localization\Services\CurrentCultureWorkContext.cs:line 28
   at Orchard.Localization.Services.CurrentCultureWorkContext.Get[T](String name) in C:\Users\BigFont\Documents\GitHub\o
rchard-cms-modules-and-themes\src\Orchard\Localization\Services\CurrentCultureWorkContext.cs:line 19
   at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7_0`1.<FindResolverForState>b__0(IWorkContextStateP
rovider wcsp) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\Environment\WorkContextImp
lementation.cs:line 32
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Orchard.Environment.WorkContextImplementation.FindResolverForState[T](String name) in C:\Users\BigFont\Documents\G
itHub\orchard-cms-modules-and-themes\src\Orchard\Environment\WorkContextImplementation.cs:line 32
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in C:\Users\BigFont\Documents\GitHub\orchar
d-cms-modules-and-themes\src\Orchard\Environment\WorkContextImplementation.cs:line 27
   at Orchard.WorkContext.get_CurrentCulture() in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\O
rchard\WorkContext.cs:line 74
   at Orchard.Localization.Text.Get(String textHint, Object[] args) in C:\Users\BigFont\Documents\GitHub\orchard-cms-mod
ules-and-themes\src\Orchard\Localization\Text.cs:line 27
   at Orchard.Commands.DefaultOrchardCommandHandler.Invoke(CommandContext context) in C:\Users\BigFont\Documents\GitHub\
orchard-cms-modules-and-themes\src\Orchard\Commands\DefaultOrchardCommandHandler.cs:line 59
   at Orchard.Commands.DefaultOrchardCommandHandler.Execute(CommandContext context) in C:\Users\BigFont\Documents\GitHub
\orchard-cms-modules-and-themes\src\Orchard\Commands\DefaultOrchardCommandHandler.cs:line 18
   at Orchard.Commands.DefaultCommandManager.Execute(CommandParameters parameters) in C:\Users\BigFont\Documents\GitHub\
orchard-cms-modules-and-themes\src\Orchard\Commands\DefaultCommandManager.cs:line 27
   at Orchard.Commands.CommandHostAgent.RunCommand(TextReader input, TextWriter output, String tenant, String[] args, Di
ctionary`2 switches) in C:\Users\BigFont\Documents\GitHub\orchard-cms-modules-and-themes\src\Orchard\Commands\CommandHos
tAgent.cs:line 86

--------------------------------------------------------------------------------
sfmskywalker commented 9 years ago

When did you pull from that branch? I just pushed some changes that should have fixed this issue. I just tried and can't reproduce. Please let me know. Thanks!

shaunluttin commented 9 years ago

I had pulled just before posting the issue.

sfmskywalker commented 9 years ago

I can't reproduce the issue. Just to be sure, can you tell me what changeset you're on?

shaunluttin commented 9 years ago

What do you mean? Do you want to SHA?

sfmskywalker commented 9 years ago

Yes, or commit message and date would also work.

thekaveman commented 9 years ago

I saw a very similar error message coming up a bunch yesterday (null problems with HttpContext)

I can tell you that it happens as a result of something after d3ccd74 (when I reset to this commit, error went away)

Here's the full text:

2015-06-10 00:00:02,287 [45] Orchard.WebApi.Filters.UnhandledApiExceptionFilter - Default - An unhandled exception was thrown in an API operation.
 http://example.url
Autofac.Core.DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Object reference not set to an instance of an object. (See inner exception for details.) ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Orchard.Environment.WorkContextAccessor.HttpContextScopeImplementation..ctor(IEnumerable`1 events, ILifetimeScope lifetimeScope, HttpContextBase httpContext, Object workContextKey)
   at Orchard.Environment.WorkContextAccessor.CreateWorkContextScope(HttpContextBase httpContext)
   at Orchard.Mvc.MvcModule.HttpContextBaseFactory(IComponentContext context)
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Features.LazyDependencies.LazyRegistrationSource.<>c__DisplayClass5`1.<>c__DisplayClass7.<CreateLazyRegistration>b__4()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Orchard.ContentManagement.DefaultContentManager.New(String contentType)
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.List()
   at Orchard.Users.Services.MembershipService.ValidateUser(String userNameOrEmail, String password)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at CSM.WebApi.Filters.RequireBasicAuthenticationAttribute.<AuthenticateAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
MrXemiu commented 9 years ago

I'm seeing this as well. Trying to create a new Orchard instance via Orchard.exe. Orchard/master commmit d1fa8d4.

Initializing Orchard session. (This might take a few seconds...)

A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.

Exception Details: Autofac.Core.DependencyResolutionException: A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.

Stack Trace:

[DependencyResolutionException: A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.] at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)

at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters) at Orchard.Environment.WorkContextImplementation.Resolve[T]() in C:\inetpub\wwwroot\orchard\orchard\src\Orchard\Environment\WorkContextImplementation.cs:line 19 at Orchard.Environment.WorkContextAccessor.ThreadStaticScopeImplementation.Resolve[TService]() in C:\inetpub\wwwroot\orchard\orchard\src\Orchard\Environment\WorkContextAccessor.cs:line 137 at Orchard.Environment.DefaultOrchardHost.StandaloneEnvironmentWorkContextScopeWrapper.Resolve[TService]() in C:\inetpub\wwwroot\orchard\orchard\src\Orchard\Environment\DefaultOrchardHost.cs:line 355 at Orchard.Setup.Services.SetupService.CreateTenantData(SetupContext context, IWorkContextScope environment) in c:\inetpub\wwwroot\orchard\orchard\src\Orchard.Web\Modules\Orchard.Setup\Services\SetupService.cs:line 197 at Orchard.Setup.Services.SetupService.Setup(SetupContext context) in c:\inetpub\wwwroot\orchard\orchard\src\Orchard.Web\Modules\Orchard.Setup\Services\SetupService.cs:line 186 at Orchard.Setup.Commands.SetupCommand.Setup() in c:\inetpub\wwwroot\orchard\orchard\src\Orchard.Web\Modules\Orchard.Setup\Commands\SetupCommand.cs:line 66

hsynlms commented 9 years ago

I run into the same issue when i try to create a new module or try to enable Orchard.CodeGeneration option.

sfmskywalker commented 9 years ago

On which branch?

hsynlms commented 9 years ago

I have experienced this related issue on Orchard 1.8.2 release.

Byronator commented 9 years ago

Just an FYI pulled the latest version yesterday and this issue appears to still exists when running "help commands" or "feature enable Orchard.CodeGeneration" at least.

sfmskywalker commented 9 years ago

From which branch did you pull?

Byronator commented 9 years ago

Ah looks like I was pulling from the dev branch. Gonna try the 1.9.x branch...

sfmskywalker commented 9 years ago

Ok, let me know. It should work from both branches since 1.9.x was recently pulled into dev.

Byronator commented 9 years ago

1.9.x seems to be fine. Thanks!

bill-cooper commented 8 years ago

@sfmskywalker - Could you tell me what change set this fix was applied in

sfmskywalker commented 8 years ago

Not off the top of my head, sorry. There have been a lot of change sets dealing with this issue, so if you're looking for a fix, your best shot is pulling the dev branch, or waiting for 1.10 to be released.

bill-cooper commented 8 years ago

OK, is this the same issue from #5306? If so, maybe I can follow the code stream and try to do a hotfix in my codebase.