{"action":"opened","issue":{"url":"https://api.github.com/repos/autofac/Autofac.Mvc/issues/9","repository_url":"https://api.github.com/repos/autofac/Autofac.Mvc","labels_url":"https://api.github.com/repos/autofac/Autofac.Mvc/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/autofac/Autofac.Mvc/issues/9/comments","events_url":"https://api.github.com/repos/autofac/Autofac.Mvc/issues/9/events","html_url":"https://github.com/autofac/Autofac.Mvc/issues/9","id":147868326,"number":9,"title":"Registering open generics not working with ASP.NET Core 1.","user":{"login":"nabinked","id":7703179,"avatar_url":"https://avatars.githubusercontent.com/u/7703179?v=3","gravatar_id":"","url":"https://api.github.com/users/nabinked","html_url":"https://github.com/nabinked","followers_url":"https://api.github.com/users/nabinked/followers","following_url":"https://api.github.com/users/nabinked/following{/other_user}","gists_url":"https://api.github.com/users/nabinked/gists{/gist_id}","starred_url":"https://api.github.com/users/nabinked/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nabinked/subscriptions","organizations_url":"https://api.github.com/users/nabinked/orgs","repos_url":"https://api.github.com/users/nabinked/repos","events_url":"https://api.github.com/users/nabinked/events{/privacy}","received_events_url":"https://api.github.com/users/nabinked/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-12T20:46:53Z","updated_at":"2016-04-12T20:46:53Z","closed_at":null,"body":"I have Autofac setup for my asp.net core project and is working fine except when I try to resolve generic types which I have registered in as\r\n\r\n`builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));`\r\n\r\nWhen I try to resolve the type in any of my Controllers using\r\n\r\n`public HomeController (Repository<User> userRepository)\r\n{\r\n            _userRepository = userRepository;\r\n}`\r\n\r\nI get the following error\r\n\r\n```\r\n`System.InvalidOperationException: Unable to resolve service for type 'ResumeMaker.DbPortal.Repository`1[ResumeMaker.Data.Models.Core.User]' while attempting to activate 'ResumeMaker.Controllers.HomeController'.\r\n   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)\r\n   at lambda_method(Closure , IServiceProvider , Object[] )\r\n   at Microsoft.AspNet.Mvc.Infrastructure.DefaultTypeActivatorCache.CreateInstance[TInstance](IServiceProvider serviceProvider, Type implementationType)\r\n   at Microsoft.AspNet.Mvc.Controllers.DefaultControllerActivator.Create(ActionContext actionContext, Type controllerType)\r\n   at Microsoft.AspNet.Mvc.Controllers.DefaultControllerFactory.CreateController(ActionContext actionContext)\r\n   at Microsoft.AspNet.Mvc.Controllers.ControllerActionInvoker.CreateInstance()\r\n   at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeAllActionFiltersAsync>d__52.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeExceptionFilterAsync>d__51.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeAsync>d__44.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Mvc.Infrastructure.MvcRouteHandler.<RouteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Routing.Template.TemplateRoute.<RouteAsync>d__27.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Routing.RouteCollection.<RouteAsync>d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.IISPlatformHandler.IISPlatformHandlerMiddleware.<Invoke>d__8.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.AspNet.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()`\r\n```\r\n\r\nAm I missing anything here?\r\n\r\nThanks"}}