{"action":"created","issue":{"url":"https://api.github.com/repos/Bikeman868/OwinFramework/issues/1","repository_url":"https://api.github.com/repos/Bikeman868/OwinFramework","labels_url":"https://api.github.com/repos/Bikeman868/OwinFramework/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/Bikeman868/OwinFramework/issues/1/comments","events_url":"https://api.github.com/repos/Bikeman868/OwinFramework/issues/1/events","html_url":"https://github.com/Bikeman868/OwinFramework/issues/1","id":201451607,"number":1,"title":"Circular dependency incorrectly reported","user":{"login":"Bikeman868","id":5679259,"avatar_url":"https://avatars.githubusercontent.com/u/5679259?v=3","gravatar_id":"","url":"https://api.github.com/users/Bikeman868","html_url":"https://github.com/Bikeman868","followers_url":"https://api.github.com/users/Bikeman868/followers","following_url":"https://api.github.com/users/Bikeman868/following{/other_user}","gists_url":"https://api.github.com/users/Bikeman868/gists{/gist_id}","starred_url":"https://api.github.com/users/Bikeman868/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bikeman868/subscriptions","organizations_url":"https://api.github.com/users/Bikeman868/orgs","repos_url":"https://api.github.com/users/Bikeman868/repos","events_url":"https://api.github.com/users/Bikeman868/events{/privacy}","received_events_url":"https://api.github.com/users/Bikeman868/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-18T01:09:01Z","updated_at":"2017-01-20T06:36:16Z","closed_at":"2017-01-20T06:36:16Z","body":"If I configure Middleware components without routing they work perfectly, but as soon as I add the same components to a route I get a circular dependency exception even though the dependencies did not change.\r\n\r\nThis is a working configuration:\r\n\r\n```\r\n                var config = unityContainer.Resolve<IConfiguration>();\r\n                var builder = unityContainer.Resolve<IBuilder>();\r\n\r\n                builder.Register(unityContainer.Resolve<OutputCacheMiddleware>())\r\n                    .As(\"Output cache\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/outputCache\");\r\n\r\n                builder.Register(unityContainer.Resolve<VersioningMiddleware>())\r\n                    .As(\"Versioning\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/less\");\r\n\r\n                builder.Register(unityContainer.Resolve<DartMiddleware>())\r\n                    .As(\"Dart\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/dart\");\r\n\r\n                builder.Register(unityContainer.Resolve<LessMiddleware>())\r\n                    .As(\"Less\")\r\n                    .RunAfter(\"Dart\")\r\n                    .RunAfter(\"Versioning\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/less\");\r\n\r\n                builder.Register(unityContainer.Resolve<StaticFilesMiddleware>())\r\n                    .As(\"Static files\")\r\n                    .RunAfter(\"Dart\")\r\n                    .RunAfter(\"Versioning\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/staticFiles\");\r\n\r\n                builder.Register(unityContainer.Resolve<RouteVisualizerMiddleware>())\r\n                    .As(\"Route visualizer\")\r\n                    .ConfigureWith(config, \"/urchin/server/visualizer\");\r\n\r\n                app.UseBuilder(builder);\r\n```\r\n\r\nBut this configuration gives a circular dependency exception:\r\n\r\n```\r\n                var config = unityContainer.Resolve<IConfiguration>();\r\n                var builder = unityContainer.Resolve<IBuilder>();\r\n\r\n                var uiPath = new PathString(\"/ui\");\r\n\r\n                builder.Register(unityContainer.Resolve<IRouter>())\r\n                    .AddRoute(\"Ui\", c => c.Request.Path.StartsWithSegments(uiPath))\r\n                    .As(\"Router\");\r\n\r\n                builder.Register(unityContainer.Resolve<OutputCacheMiddleware>())\r\n                    .As(\"Output cache\")\r\n                    .RunOnRoute(\"Ui\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/outputCache\");\r\n\r\n                builder.Register(unityContainer.Resolve<VersioningMiddleware>())\r\n                    .As(\"Versioning\")\r\n                    .RunOnRoute(\"Ui\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/less\");\r\n\r\n                builder.Register(unityContainer.Resolve<DartMiddleware>())\r\n                    .As(\"Dart\")\r\n                    .RunOnRoute(\"Ui\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/dart\");\r\n\r\n                builder.Register(unityContainer.Resolve<LessMiddleware>())\r\n                    .As(\"Less\")\r\n                    .RunOnRoute(\"Ui\")\r\n                    .RunAfter(\"Dart\")\r\n                    .RunAfter(\"Versioning\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/less\");\r\n\r\n                builder.Register(unityContainer.Resolve<StaticFilesMiddleware>())\r\n                    .As(\"Static files\")\r\n                    .RunOnRoute(\"Ui\")\r\n                    .RunAfter(\"Dart\")\r\n                    .RunAfter(\"Versioning\")\r\n                    .ConfigureWith(config, \"/urchin/server/ui/staticFiles\");\r\n\r\n                builder.Register(unityContainer.Resolve<RouteVisualizerMiddleware>())\r\n                    .RunOnRoute(\"Ui\")\r\n                    .As(\"Route visualizer\")\r\n                    .ConfigureWith(config, \"/urchin/server/visualizer\");\r\n\r\n                app.UseBuilder(builder);\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/Bikeman868/OwinFramework/issues/comments/273989098","html_url":"https://github.com/Bikeman868/OwinFramework/issues/1#issuecomment-273989098","issue_url":"https://api.github.com/repos/Bikeman868/OwinFramework/issues/1","id":273989098,"user":{"login":"Bikeman868","id":5679259,"avatar_url":"https://avatars.githubusercontent.com/u/5679259?v=3","gravatar_id":"","url":"https://api.github.com/users/Bikeman868","html_url":"https://github.com/Bikeman868","followers_url":"https://api.github.com/users/Bikeman868/followers","following_url":"https://api.github.com/users/Bikeman868/following{/other_user}","gists_url":"https://api.github.com/users/Bikeman868/gists{/gist_id}","starred_url":"https://api.github.com/users/Bikeman868/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bikeman868/subscriptions","organizations_url":"https://api.github.com/users/Bikeman868/orgs","repos_url":"https://api.github.com/users/Bikeman868/repos","events_url":"https://api.github.com/users/Bikeman868/events{/privacy}","received_events_url":"https://api.github.com/users/Bikeman868/received_events","type":"User","site_admin":false},"created_at":"2017-01-20T06:36:16Z","updated_at":"2017-01-20T06:36:16Z","body":"This turned out to be a bug in the Versioning middleware which was incorrectly identifying itself as an output cache, which was indeed a circular dependency,"}}
{"actor":{"display_login":"Bikeman868"}}