GitHub PullRequestReviewCommentEvent at 2014-09-11 18:06:54
Repository: Mvc
Actor: rynowak
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/17437393","id":17437393,"diff_hunk":"@@ -203,34 +241,121 @@ public List<ReflectedActionDescriptor> Build(ReflectedApplicationModel model)\n                 }\n             }\n \n-            var namedRoutedErrors = ValidateNamedAttributeRoutedActions(actionsByRouteName);\n-            if (namedRoutedErrors.Any())\n+            if (attributeRoutingConfigurationErrors.Any())\n             {\n-                namedRoutedErrors = AddErrorNumbers(namedRoutedErrors);\n+                var message = CreateAttributeRoutingAggregateErrorMessage(\n+                    attributeRoutingConfigurationErrors.Values);\n \n-                var message = Resources.FormatAttributeRoute_AggregateErrorMessage(\n-                    Environment.NewLine,\n-                    string.Join(Environment.NewLine + Environment.NewLine, namedRoutedErrors));\n+                throw new InvalidOperationException(message);\n+            }\n \n+            var namedRoutedErrors = ValidateNamedAttributeRoutedActions(actionsByRouteName);\n+            if (namedRoutedErrors.Any())\n+            {\n+                var message = CreateAttributeRoutingAggregateErrorMessage(namedRoutedErrors);\n                 throw new InvalidOperationException(message);\n             }\n \n             if (routeTemplateErrors.Any())\n             {\n-                var message = Resources.FormatAttributeRoute_AggregateErrorMessage(\n-                    Environment.NewLine,\n-                    string.Join(Environment.NewLine + Environment.NewLine, routeTemplateErrors));\n-\n+                var message = CreateAttributeRoutingAggregateErrorMessage(routeTemplateErrors);\n                 throw new InvalidOperationException(message);\n             }\n \n             return actions;\n         }\n \n-        private static ReflectedActionDescriptor CreateActionDescriptor(ReflectedActionModel action,\n+        private void AddToMethodInfoMap(\n+            IDictionary<MethodInfo, IDictionary<ReflectedActionModel, IList<ReflectedActionDescriptor>>> methodMap,\n+            ReflectedActionModel action,\n+            IList<ReflectedActionDescriptor> actionDescriptors)\n+        {\n+            //var filteredList = new List<ReflectedActionDescriptor>();\n+\n+            IDictionary<ReflectedActionModel, IList<ReflectedActionDescriptor>> actionsForMethod = null;\n+            if (methodMap.TryGetValue(action.ActionMethod, out actionsForMethod))\n+            {\n+                actionsForMethod.Add(action, actionDescriptors);\n+            }\n+            else\n+            {\n+                var reflectedActionMap = new Dictionary<ReflectedActionModel, IList<ReflectedActionDescriptor>>();\n+                reflectedActionMap.Add(action, actionDescriptors);\n+                methodMap.Add(action.ActionMethod, reflectedActionMap);\n+            }\n+        }\n+\n+        private static bool HasSameRouteTemplate(\n+            ActionDescriptor first,\n+            ActionDescriptor second)\n+        {\n+            return first.AttributeRouteInfo != null &&\n+                first.AttributeRouteInfo.Template != null &&\n+                second.AttributeRouteInfo != null &&\n+                first.AttributeRouteInfo.Template.Equals(\n+                    second.AttributeRouteInfo.Template,\n+                    StringComparison.OrdinalIgnoreCase);\n+        }\n+\n+        private static bool HasCommonHttpMethod(\n+            ActionDescriptor first,\n+            ActionDescriptor second)\n+        {\n+            // One of the actions isn't constrained to a given set of HTTP methods\n+            // so the two actions will be ambiguous. This will happen if you use\n+            // [HttpGet(\"Products\")] and [Route(\"Products\")] in the same method.","path":"src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptorProvider.cs","position":204,"original_position":204,"commit_id":"5ee3151dfc32a5edf6a45d5a6d19a52639356672","original_commit_id":"5ee3151dfc32a5edf6a45d5a6d19a52639356672","user":{"login":"rynowak","id":1430011,"avatar_url":"https://avatars.githubusercontent.com/u/1430011?v=2","gravatar_id":"8a6cc82fe52d3e7f9e820ce0cef2b7ee","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false},"body":"This isn't true. The `[HttpGet(...)]` will always win for *GET* and won't match any other verb - there's no ambiguity. \r\n\r\nThere's actually another problem here when we bring back `ActionSelectorAttribute` because that's another way to disambiguate actions.","created_at":"2014-09-11T18:06:54Z","updated_at":"2014-09-11T18:06:54Z","html_url":"https://github.com/aspnet/Mvc/pull/1122#discussion_r17437393","pull_request_url":"https://api.github.com/repos/aspnet/Mvc/pulls/1122","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/17437393"},"html":{"href":"https://github.com/aspnet/Mvc/pull/1122#discussion_r17437393"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1122"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Mvc/pulls/1122","id":21065683,"html_url":"https://github.com/aspnet/Mvc/pull/1122","diff_url":"https://github.com/aspnet/Mvc/pull/1122.diff","patch_url":"https://github.com/aspnet/Mvc/pull/1122.patch","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/1122","number":1122,"state":"open","locked":false,"title":"[Fixes #739] Attribute Routing: Multiple routes per-action","user":{"login":"javiercn","id":6995051,"avatar_url":"https://avatars.githubusercontent.com/u/6995051?v=2","gravatar_id":"adf1b36cdce7542cb90dd622ac4ec671","url":"https://api.github.com/users/javiercn","html_url":"https://github.com/javiercn","followers_url":"https://api.github.com/users/javiercn/followers","following_url":"https://api.github.com/users/javiercn/following{/other_user}","gists_url":"https://api.github.com/users/javiercn/gists{/gist_id}","starred_url":"https://api.github.com/users/javiercn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiercn/subscriptions","organizations_url":"https://api.github.com/users/javiercn/orgs","repos_url":"https://api.github.com/users/javiercn/repos","events_url":"https://api.github.com/users/javiercn/events{/privacy}","received_events_url":"https://api.github.com/users/javiercn/received_events","type":"User","site_admin":false},"body":"1. Support multiple [Http*] attributes on an action.\r\n2. Support multiple [Route] attributes on a controller and on an action.\r\n3. Support creating multiple attribute routes using [AcceptVerbs(\"...\", Template =\"...\")]\r\n4. Detect attribute routed actions during action discovery\r\n   and return one action per [Http*], [Route] or [AcceptVerbs] attribute found on the method when there is\r\n   at least one valid attribute route.\r\n5. Merge all the HTTP methods of [Http*] and [AcceptVerbs] attributes in a method during action discovery \r\n    when there are no valid attribute routes defined on the action.\r\n6. Build one action descriptor per controller [Route] + action [Http*], [AcceptVerbs] or [Route] combination\r\n   in an action.\r\n7. Disallow the use of attributes that do not implement IActionHttpMethodProvider and\r\n    IRouteTemplateProvider simultaneously in methods that define attribute routed actions and throw an\r\n    exception during startup.\r\n8. Disallow mixing attribute routed and non attribute routed actions on the same method and throw an\r\n    exception during startup.\r\n9. Disallow creating attribute routed actions that have same template and have an HTTP method in common\r\n    on the same action and throw an exception during startup.","created_at":"2014-09-11T04:15:40Z","updated_at":"2014-09-11T18:06:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"618f2714e01729ed8c1f2354711895fe0b95e2ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Mvc/pulls/1122/commits","review_comments_url":"https://api.github.com/repos/aspnet/Mvc/pulls/1122/comments","review_comment_url":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/{number}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/1122/comments","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/5ee3151dfc32a5edf6a45d5a6d19a52639356672","head":{"label":"aspnet:issue739","ref":"issue739","sha":"5ee3151dfc32a5edf6a45d5a6d19a52639356672","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":null,"url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15126429,"name":"Mvc","full_name":"aspnet/Mvc","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":null,"url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Mvc","description":"","fork":false,"url":"https://api.github.com/repos/aspnet/Mvc","forks_url":"https://api.github.com/repos/aspnet/Mvc/forks","keys_url":"https://api.github.com/repos/aspnet/Mvc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Mvc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Mvc/teams","hooks_url":"https://api.github.com/repos/aspnet/Mvc/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Mvc/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Mvc/events","assignees_url":"https://api.github.com/repos/aspnet/Mvc/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Mvc/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Mvc/tags","blobs_url":"https://api.github.com/repos/aspnet/Mvc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Mvc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Mvc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Mvc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Mvc/languages","stargazers_url":"https://api.github.com/repos/aspnet/Mvc/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Mvc/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Mvc/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Mvc/subscription","commits_url":"https://api.github.com/repos/aspnet/Mvc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Mvc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Mvc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/Mvc/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Mvc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Mvc/merges","archive_url":"https://api.github.com/repos/aspnet/Mvc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Mvc/downloads","issues_url":"https://api.github.com/repos/aspnet/Mvc/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Mvc/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Mvc/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Mvc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Mvc/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Mvc/releases{/id}","created_at":"2013-12-12T03:54:00Z","updated_at":"2014-09-11T11:11:15Z","pushed_at":"2014-09-11T18:02:07Z","git_url":"git://github.com/aspnet/Mvc.git","ssh_url":"git@github.com:aspnet/Mvc.git","clone_url":"https://github.com/aspnet/Mvc.git","svn_url":"https://github.com/aspnet/Mvc","homepage":null,"size":35872,"stargazers_count":691,"watchers_count":691,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":180,"mirror_url":null,"open_issues_count":339,"forks":180,"open_issues":339,"watchers":691,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"85ad1aeb96b95ec48ddb8abd0c4a3061206bc8ef","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":null,"url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15126429,"name":"Mvc","full_name":"aspnet/Mvc","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":null,"url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Mvc","description":"","fork":false,"url":"https://api.github.com/repos/aspnet/Mvc","forks_url":"https://api.github.com/repos/aspnet/Mvc/forks","keys_url":"https://api.github.com/repos/aspnet/Mvc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Mvc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Mvc/teams","hooks_url":"https://api.github.com/repos/aspnet/Mvc/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Mvc/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Mvc/events","assignees_url":"https://api.github.com/repos/aspnet/Mvc/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Mvc/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Mvc/tags","blobs_url":"https://api.github.com/repos/aspnet/Mvc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Mvc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Mvc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Mvc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Mvc/languages","stargazers_url":"https://api.github.com/repos/aspnet/Mvc/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Mvc/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Mvc/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Mvc/subscription","commits_url":"https://api.github.com/repos/aspnet/Mvc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Mvc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Mvc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/Mvc/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Mvc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Mvc/merges","archive_url":"https://api.github.com/repos/aspnet/Mvc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Mvc/downloads","issues_url":"https://api.github.com/repos/aspnet/Mvc/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Mvc/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Mvc/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Mvc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Mvc/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Mvc/releases{/id}","created_at":"2013-12-12T03:54:00Z","updated_at":"2014-09-11T11:11:15Z","pushed_at":"2014-09-11T18:02:07Z","git_url":"git://github.com/aspnet/Mvc.git","ssh_url":"git@github.com:aspnet/Mvc.git","clone_url":"https://github.com/aspnet/Mvc.git","svn_url":"https://github.com/aspnet/Mvc","homepage":null,"size":35872,"stargazers_count":691,"watchers_count":691,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":180,"mirror_url":null,"open_issues_count":339,"forks":180,"open_issues":339,"watchers":691,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1122"},"html":{"href":"https://github.com/aspnet/Mvc/pull/1122"},"issue":{"href":"https://api.github.com/repos/aspnet/Mvc/issues/1122"},"comments":{"href":"https://api.github.com/repos/aspnet/Mvc/issues/1122/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1122/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1122/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Mvc/statuses/5ee3151dfc32a5edf6a45d5a6d19a52639356672"}}}}