question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UPDATE ASP.net core 1.1 I got error

See original GitHub issue

Hello after update all packages in generated template to new .net 1.1.0 version a I got this error.

HandlerException: Can't create component 'Microsoft.Extensions.Options.IConfigureOptions`1[[Microsoft.AspNetCore.Mvc.MvcOptions, Microsoft.AspNetCore.Mvc.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]_9d4ed88d-54ed-47e6-a55e-26d487b87712' as it has dependencies to be satisfied.
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)

HandlerException: Can't create component 'Microsoft.Extensions.Options.IConfigureOptions`1[[Microsoft.AspNetCore.Mvc.MvcOptions, Microsoft.AspNetCore.Mvc.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]_9d4ed88d-54ed-47e6-a55e-26d487b87712' as it has dependencies to be satisfied.
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.ResolveAll(Type service, IDictionary arguments, IReleasePolicy policy)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.Windsor.MsDependencyInjection.MyScopedSingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.Handlers.DefaultGenericHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, bool isOptional)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<T>(IServiceProvider provider)
Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions+<>c.<AddMvcCoreServices>b__5_0(IServiceProvider s)
Castle.MicroKernel.ComponentActivator.FactoryMethodActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.Windsor.MsDependencyInjection.MsScopedTransientLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.Windsor.MsDependencyInjection.MyScopedSingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.Windsor.MsDependencyInjection.MsScopedTransientLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.ResolveAll(Type service, IDictionary arguments, IReleasePolicy policy)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.Windsor.MsDependencyInjection.MyScopedSingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.Windsor.MsDependencyInjection.MsScopedTransientLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.ResolveAll(Type service, IDictionary arguments, IReleasePolicy policy)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.Windsor.MsDependencyInjection.MyScopedSingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.Windsor.MsDependencyInjection.MyScopedSingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, bool isOptional)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<T>(IServiceProvider provider)
Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action<IRouteBuilder> configureRoutes)
Fibit.Bruno.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in Startup.cs
+
            app.UseMvc(routes =>
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Do anybody know how to fix it ? Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
hankorcommented, Nov 18, 2016

Same problem occurs when adding https://github.com/volosoft/castle-windsor-ms-adapter to a new MVC site created using the default Visual Studio Template - I did try using the “ASP.NET Core Web Application (.NET Framework)”.

Same error message that various IOptions can’t be resolved as dependencies would have to be satified but without actually listing any dependencies.

I did debug this a bit further:

  • The missing dependency occurs as Windsor can’t find a valid constructor:
Exception thrown: 'Castle.MicroKernel.ComponentActivator.NoResolvableConstructorFoundException' in Castle.Windsor.dll
Additional information: Could not find resolvable constructor for Microsoft.AspNetCore.Mvc.DataAnnotations.Internal.MvcDataAnnotationsMvcOptionsSetup. Make sure all required dependencies are provided.
  • Not too sure about all the Windsor internals but the problem seems to be that the open generic registration IOptions<> -> OptionsManager<> somehow is added to “handlerStack” that Windsor seems to check to see if the current handler is already being resolved and then doesn’t consider it a valid subdependency.

I was able to work around the problem using:

public class OptionsResolver : ISubDependencyResolver
{
    protected readonly IKernel kernel;

    public OptionsResolver(IKernel kernel)
    {
        this.kernel = kernel;
    }

    public bool CanResolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
    {
        return dependency.TargetType.IsGenericType && dependency.TargetType.GetGenericTypeDefinition() == typeof(IOptions<>);
    }

    public object Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
    {
        return kernel.Resolve(dependency.TargetType);
    }
}
container.Kernel.Resolver.AddSubResolver(new OptionsResolver(container.Kernel))

This obviously isn’t a final solution. Hope this helps to find one

0reactions
hikalkancommented, Nov 28, 2016

I spent a few hours and could not find the actual reason, but your solution works perfectly 😃 Thanks a lot. I will continue to understand the actual reason, but will use your solution if can not find.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors upgrading .NET Core app to 1.1
So, I have a happily working ASP.NET Core 1.0 app targeting net461 framework. Today I tried to upgrade it to the new ASP.NET...
Read more >
Error when Upgrading Existing ASP.NET Core 1.0 ...
NET Core 1.1 article we upgraded our existing ASP.NET Core 1.0 project to ASP ... When compiling the application we got the following...
Read more >
Migrate from ASP.NET Core 1.x to 2.0
In this article, we walk you through updating an existing ASP.NET Core 1.x project to ASP.NET Core 2.0. Migrating your application to ASP....
Read more >
NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
Error Upgrading to Visual Studio 2017 15.1 Unable to do . ...
I got an error when upgrading to Visual Studio 2017 15.1 where it wouldn't install the .NET Core workload. This prevented me from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found