{"action":"created","issue":{"url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions/issues/1","repository_url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions","labels_url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions/issues/1/comments","events_url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions/issues/1/events","html_url":"https://github.com/dotnetjunkie/Missing-Core-DI-Extensions/issues/1","id":191828060,"number":1,"title":"CustomFilterProvider","user":{"login":"omar","id":196368,"avatar_url":"https://avatars.githubusercontent.com/u/196368?v=3","gravatar_id":"","url":"https://api.github.com/users/omar","html_url":"https://github.com/omar","followers_url":"https://api.github.com/users/omar/followers","following_url":"https://api.github.com/users/omar/following{/other_user}","gists_url":"https://api.github.com/users/omar/gists{/gist_id}","starred_url":"https://api.github.com/users/omar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omar/subscriptions","organizations_url":"https://api.github.com/users/omar/orgs","repos_url":"https://api.github.com/users/omar/repos","events_url":"https://api.github.com/users/omar/events{/privacy}","received_events_url":"https://api.github.com/users/omar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-26T21:35:39Z","updated_at":"2016-11-27T21:08:41Z","closed_at":null,"body":"Thank you for creating this repo and pushing Microsoft to add more flexibility in choice of containers.\r\n\r\nUsing the sample Ninject, project, I set everything up but I'm getting an error when I try to resolve/active a filter of type `IAuthorizationFilter` which depends on a types in my container.\r\n\r\nIs there a way to replace the activator for filters? I tried to replace the `IFilterProvider` via:\r\n\r\n``` c#\r\npublic static void AddCustomFilterProvider(this IServiceCollection services, \r\n    Func<Type, object> provider)\r\n{\r\n    if (services == null) throw new ArgumentNullException(nameof(services));\r\n    if (provider == null) throw new ArgumentNullException(nameof(provider));\r\n\r\n    services.AddSingleton<IFilterProvider>(new DelegatingFilterProvider(provider));\r\n}\r\n```\r\n\r\nBut I wasn't able to get a breakpoint in `DelegatingFilterProvider` to hit. `DelegatingFilterProvider` just inherits from `DefaultFilterProvider` at the moment.\r\n\r\nHere's the relevant part of the exception:\r\n\r\n```\r\nSystem.InvalidOperationException: Unable to resolve service for type 'Omar.IMyService' while attempting to activate 'Omar.MyFilter'.\r\n   at Microsoft.Extensions.Internal.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)\r\n   at lambda_method(Closure , IServiceProvider , Object[] )\r\n   at Microsoft.AspNetCore.Mvc.TypeFilterAttribute.CreateInstance(IServiceProvider serviceProvider)\r\n   at Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProvider.ProvideFilter(FilterProviderContext context, FilterItem filterItem)\r\n   at Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProvider.OnProvidersExecuting(FilterProviderContext context)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache.GetFilters(ActionContext actionContext, List`1 filterItems)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache.GetState(ControllerContext controllerContext)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker..ctor(ControllerActionInvokerCache cache, IControllerFactory controllerFactory, IControllerArgumentBinder controllerArgumentBinder, ILogger logger, DiagnosticSource diagnosticSource, ActionContext actionContext, IReadOnlyList`1 valueProviderFactories, Int32 maxModelValidationErrors)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ActionInvokerFactory.CreateInvoker(ActionContext actionContext)\r\n   at Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler.<>c__DisplayClass8_0.<RouteAsync>b__0(HttpContext c)\r\n   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()\r\n```\r\n\r\nAny thoughts on how to do that?"},"comment":{"url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions/issues/comments/263147687","html_url":"https://github.com/dotnetjunkie/Missing-Core-DI-Extensions/issues/1#issuecomment-263147687","issue_url":"https://api.github.com/repos/dotnetjunkie/Missing-Core-DI-Extensions/issues/1","id":263147687,"user":{"login":"dotnetjunkie","id":1506621,"avatar_url":"https://avatars.githubusercontent.com/u/1506621?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnetjunkie","html_url":"https://github.com/dotnetjunkie","followers_url":"https://api.github.com/users/dotnetjunkie/followers","following_url":"https://api.github.com/users/dotnetjunkie/following{/other_user}","gists_url":"https://api.github.com/users/dotnetjunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnetjunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnetjunkie/subscriptions","organizations_url":"https://api.github.com/users/dotnetjunkie/orgs","repos_url":"https://api.github.com/users/dotnetjunkie/repos","events_url":"https://api.github.com/users/dotnetjunkie/events{/privacy}","received_events_url":"https://api.github.com/users/dotnetjunkie/received_events","type":"User","site_admin":false},"created_at":"2016-11-27T21:08:41Z","updated_at":"2016-11-27T21:08:41Z","body":"> at this point, I think the only reliable route is to follow in the footsteps of Autofac and other DI containers and create an adapter\r\n\r\nI surely don't advice you to go this route. Having seen the amount of pain the Autofac maintainers have gone through, I think it is safe to say that it is undoable for a non-maintainer to build a reliable adapter; at this point, it's unclear whether the maintainers of Ninject would be able to succeed.\r\n\r\n> replace the built-in DI framework in ASP.NET Core using the files in this repo\r\n\r\nDon't try to \"replace the built-in DI framework\". You should leave it as-is. Leave it in for all framework stuff and only plugin your container to resolve application components. I agree this isn't ideal at the moment, due to the lacking design of ASP.NET Core, but going the Conforming Container root will not solve your problems at all. I'm afraid we will have to bite the bullet on this one. After we know where the flaws and shortcomings are, we can communicate this to Microsoft and they can improve their design to minimize the pain for us."}}
{"actor":{"display_login":"dotnetjunkie"}}