{"action":"created","comment":{"url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/comments/175304756","pull_request_review_id":104812060,"id":175304756,"diff_hunk":"@@ -3,27 +3,64 @@\n using System.Linq;\n using System.Linq.Expressions;\n using System.Reflection;\n+using System.Runtime.CompilerServices;\n \n namespace FluentAssertions.Common\n {\n     public static class MethodInfoExtensions\n     {\n+        private static Lazy<int> ImplementationOptionsMask = new Lazy<int>(() => Enum.GetValues(typeof(MethodImplOptions)).Cast<int>().Sum(x => x));\n+\n         internal static bool IsAsync(this MethodInfo methodInfo)\n         {\n             return methodInfo.GetMatchingAttributes<Attribute>(a => a.GetType().FullName.Equals(\"System.Runtime.CompilerServices.AsyncStateMachineAttribute\")).Any();\n         }\n \n         internal static IEnumerable<TAttribute> GetMatchingAttributes<TAttribute>(this MemberInfo memberInfo, Expression<Func<TAttribute, bool>> isMatchingAttributePredicate) where TAttribute : Attribute\n         {\n-            return memberInfo.GetCustomAttributes(\n+            var customAttributes = memberInfo.GetCustomAttributes(\n                 typeof(TAttribute), false)\n                 .Cast<TAttribute>()\n+                .ToList();\n+\n+            if(typeof(TAttribute) == typeof(MethodImplAttribute))\n+            {\n+                var (success, methodImplAttribute) = RecreateMethodImplAttribute(memberInfo);\n+\n+                if (success)\n+                {\n+                    customAttributes.Add(methodImplAttribute as TAttribute);\n+                }\n+            }\n+\n+            return customAttributes\n                 .Where(isMatchingAttributePredicate.Compile());\n         }\n \n         internal static bool IsNonVirtual(this MethodInfo method)\n         {\n             return !method.IsVirtual || method.IsFinal;\n         }\n+\n+        private static (bool success, MethodImplAttribute attribute) RecreateMethodImplAttribute(MemberInfo memberInfo)\n+        {\n+            var methodInfo = memberInfo as MethodInfo ?? null;\n+\n+            var implementationFlags = methodInfo.MethodImplementationFlags;","path":"Src/FluentAssertions/Common/MethodInfoExtensions.cs","position":48,"original_position":48,"commit_id":"b8f56b2d26925f21766a6fd5659e637e83ca4f66","original_commit_id":"b8f56b2d26925f21766a6fd5659e637e83ca4f66","user":{"login":"jnyrup","id":919634,"avatar_url":"https://avatars1.githubusercontent.com/u/919634?v=4","gravatar_id":"","url":"https://api.github.com/users/jnyrup","html_url":"https://github.com/jnyrup","followers_url":"https://api.github.com/users/jnyrup/followers","following_url":"https://api.github.com/users/jnyrup/following{/other_user}","gists_url":"https://api.github.com/users/jnyrup/gists{/gist_id}","starred_url":"https://api.github.com/users/jnyrup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnyrup/subscriptions","organizations_url":"https://api.github.com/users/jnyrup/orgs","repos_url":"https://api.github.com/users/jnyrup/repos","events_url":"https://api.github.com/users/jnyrup/events{/privacy}","received_events_url":"https://api.github.com/users/jnyrup/received_events","type":"User","site_admin":false},"body":"and avoid NRE here if someone tried to check on a non-method member.","created_at":"2018-03-18T21:30:21Z","updated_at":"2018-03-18T22:03:01Z","html_url":"https://github.com/fluentassertions/fluentassertions/pull/804#discussion_r175304756","pull_request_url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/comments/175304756"},"html":{"href":"https://github.com/fluentassertions/fluentassertions/pull/804#discussion_r175304756"},"pull_request":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804"}}},"pull_request":{"url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804","id":175762398,"html_url":"https://github.com/fluentassertions/fluentassertions/pull/804","diff_url":"https://github.com/fluentassertions/fluentassertions/pull/804.diff","patch_url":"https://github.com/fluentassertions/fluentassertions/pull/804.patch","issue_url":"https://api.github.com/repos/fluentassertions/fluentassertions/issues/804","number":804,"state":"open","locked":false,"title":"Handle MethodImplAttribute","user":{"login":"melchiork","id":2656932,"avatar_url":"https://avatars0.githubusercontent.com/u/2656932?v=4","gravatar_id":"","url":"https://api.github.com/users/melchiork","html_url":"https://github.com/melchiork","followers_url":"https://api.github.com/users/melchiork/followers","following_url":"https://api.github.com/users/melchiork/following{/other_user}","gists_url":"https://api.github.com/users/melchiork/gists{/gist_id}","starred_url":"https://api.github.com/users/melchiork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melchiork/subscriptions","organizations_url":"https://api.github.com/users/melchiork/orgs","repos_url":"https://api.github.com/users/melchiork/repos","events_url":"https://api.github.com/users/melchiork/events{/privacy}","received_events_url":"https://api.github.com/users/melchiork/received_events","type":"User","site_admin":false},"body":"PoC for #781\r\nThe code recreates the `MethodImplAttribute` using `MethodImplementationFlags`.\r\n","created_at":"2018-03-18T17:19:22Z","updated_at":"2018-03-18T22:03:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cde65351f7a64250f1c74e9ca40a3bca5213852c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804/commits","review_comments_url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804/comments","review_comment_url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fluentassertions/fluentassertions/issues/804/comments","statuses_url":"https://api.github.com/repos/fluentassertions/fluentassertions/statuses/b8f56b2d26925f21766a6fd5659e637e83ca4f66","head":{"label":"melchiork:HandleMethodImplAttribute","ref":"HandleMethodImplAttribute","sha":"b8f56b2d26925f21766a6fd5659e637e83ca4f66","user":{"login":"melchiork","id":2656932,"avatar_url":"https://avatars0.githubusercontent.com/u/2656932?v=4","gravatar_id":"","url":"https://api.github.com/users/melchiork","html_url":"https://github.com/melchiork","followers_url":"https://api.github.com/users/melchiork/followers","following_url":"https://api.github.com/users/melchiork/following{/other_user}","gists_url":"https://api.github.com/users/melchiork/gists{/gist_id}","starred_url":"https://api.github.com/users/melchiork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melchiork/subscriptions","organizations_url":"https://api.github.com/users/melchiork/orgs","repos_url":"https://api.github.com/users/melchiork/repos","events_url":"https://api.github.com/users/melchiork/events{/privacy}","received_events_url":"https://api.github.com/users/melchiork/received_events","type":"User","site_admin":false},"repo":{"id":114042377,"name":"fluentassertions","full_name":"melchiork/fluentassertions","owner":{"login":"melchiork","id":2656932,"avatar_url":"https://avatars0.githubusercontent.com/u/2656932?v=4","gravatar_id":"","url":"https://api.github.com/users/melchiork","html_url":"https://github.com/melchiork","followers_url":"https://api.github.com/users/melchiork/followers","following_url":"https://api.github.com/users/melchiork/following{/other_user}","gists_url":"https://api.github.com/users/melchiork/gists{/gist_id}","starred_url":"https://api.github.com/users/melchiork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melchiork/subscriptions","organizations_url":"https://api.github.com/users/melchiork/orgs","repos_url":"https://api.github.com/users/melchiork/repos","events_url":"https://api.github.com/users/melchiork/events{/privacy}","received_events_url":"https://api.github.com/users/melchiork/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/melchiork/fluentassertions","description":"Fluent Assertions is a set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test. We currently use it in all our internal and client projects, and it is used in many open-source projects. It runs on .NET 4.0, 4.5, 4.6, CoreClr, .NET Native, Windows 8.1, Silverlight 5, Windows Phone 8.0 and UWP. It supports the unit test frameworks MSTest, MSTest2, NUnit, XUnit, MBUnit, Gallio, NSpec and MSpec.","fork":true,"url":"https://api.github.com/repos/melchiork/fluentassertions","forks_url":"https://api.github.com/repos/melchiork/fluentassertions/forks","keys_url":"https://api.github.com/repos/melchiork/fluentassertions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/melchiork/fluentassertions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/melchiork/fluentassertions/teams","hooks_url":"https://api.github.com/repos/melchiork/fluentassertions/hooks","issue_events_url":"https://api.github.com/repos/melchiork/fluentassertions/issues/events{/number}","events_url":"https://api.github.com/repos/melchiork/fluentassertions/events","assignees_url":"https://api.github.com/repos/melchiork/fluentassertions/assignees{/user}","branches_url":"https://api.github.com/repos/melchiork/fluentassertions/branches{/branch}","tags_url":"https://api.github.com/repos/melchiork/fluentassertions/tags","blobs_url":"https://api.github.com/repos/melchiork/fluentassertions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/melchiork/fluentassertions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/melchiork/fluentassertions/git/refs{/sha}","trees_url":"https://api.github.com/repos/melchiork/fluentassertions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/melchiork/fluentassertions/statuses/{sha}","languages_url":"https://api.github.com/repos/melchiork/fluentassertions/languages","stargazers_url":"https://api.github.com/repos/melchiork/fluentassertions/stargazers","contributors_url":"https://api.github.com/repos/melchiork/fluentassertions/contributors","subscribers_url":"https://api.github.com/repos/melchiork/fluentassertions/subscribers","subscription_url":"https://api.github.com/repos/melchiork/fluentassertions/subscription","commits_url":"https://api.github.com/repos/melchiork/fluentassertions/commits{/sha}","git_commits_url":"https://api.github.com/repos/melchiork/fluentassertions/git/commits{/sha}","comments_url":"https://api.github.com/repos/melchiork/fluentassertions/comments{/number}","issue_comment_url":"https://api.github.com/repos/melchiork/fluentassertions/issues/comments{/number}","contents_url":"https://api.github.com/repos/melchiork/fluentassertions/contents/{+path}","compare_url":"https://api.github.com/repos/melchiork/fluentassertions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/melchiork/fluentassertions/merges","archive_url":"https://api.github.com/repos/melchiork/fluentassertions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/melchiork/fluentassertions/downloads","issues_url":"https://api.github.com/repos/melchiork/fluentassertions/issues{/number}","pulls_url":"https://api.github.com/repos/melchiork/fluentassertions/pulls{/number}","milestones_url":"https://api.github.com/repos/melchiork/fluentassertions/milestones{/number}","notifications_url":"https://api.github.com/repos/melchiork/fluentassertions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/melchiork/fluentassertions/labels{/name}","releases_url":"https://api.github.com/repos/melchiork/fluentassertions/releases{/id}","deployments_url":"https://api.github.com/repos/melchiork/fluentassertions/deployments","created_at":"2017-12-12T21:45:13Z","updated_at":"2017-12-12T21:45:16Z","pushed_at":"2018-03-18T17:16:16Z","git_url":"git://github.com/melchiork/fluentassertions.git","ssh_url":"git@github.com:melchiork/fluentassertions.git","clone_url":"https://github.com/melchiork/fluentassertions.git","svn_url":"https://github.com/melchiork/fluentassertions","homepage":"http://www.fluentassertions.com","size":21314,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"release-5.0"}},"base":{"label":"fluentassertions:master","ref":"master","sha":"c61c46b808befdd2d0090b3fb9f4d635f36ffdc3","user":{"login":"fluentassertions","id":25584770,"avatar_url":"https://avatars1.githubusercontent.com/u/25584770?v=4","gravatar_id":"","url":"https://api.github.com/users/fluentassertions","html_url":"https://github.com/fluentassertions","followers_url":"https://api.github.com/users/fluentassertions/followers","following_url":"https://api.github.com/users/fluentassertions/following{/other_user}","gists_url":"https://api.github.com/users/fluentassertions/gists{/gist_id}","starred_url":"https://api.github.com/users/fluentassertions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fluentassertions/subscriptions","organizations_url":"https://api.github.com/users/fluentassertions/orgs","repos_url":"https://api.github.com/users/fluentassertions/repos","events_url":"https://api.github.com/users/fluentassertions/events{/privacy}","received_events_url":"https://api.github.com/users/fluentassertions/received_events","type":"Organization","site_admin":false},"repo":{"id":11718424,"name":"fluentassertions","full_name":"fluentassertions/fluentassertions","owner":{"login":"fluentassertions","id":25584770,"avatar_url":"https://avatars1.githubusercontent.com/u/25584770?v=4","gravatar_id":"","url":"https://api.github.com/users/fluentassertions","html_url":"https://github.com/fluentassertions","followers_url":"https://api.github.com/users/fluentassertions/followers","following_url":"https://api.github.com/users/fluentassertions/following{/other_user}","gists_url":"https://api.github.com/users/fluentassertions/gists{/gist_id}","starred_url":"https://api.github.com/users/fluentassertions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fluentassertions/subscriptions","organizations_url":"https://api.github.com/users/fluentassertions/orgs","repos_url":"https://api.github.com/users/fluentassertions/repos","events_url":"https://api.github.com/users/fluentassertions/events{/privacy}","received_events_url":"https://api.github.com/users/fluentassertions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fluentassertions/fluentassertions","description":"Fluent API for asserting the results of unit tests that targets .NET Framework 4.5, .NET Standard 1.4, 1.6 and 2.0. Supports the unit test frameworks MSTest, MSTest2, Gallio, NUnit, XUnit, MBunit, MSpec, and NSpec.","fork":false,"url":"https://api.github.com/repos/fluentassertions/fluentassertions","forks_url":"https://api.github.com/repos/fluentassertions/fluentassertions/forks","keys_url":"https://api.github.com/repos/fluentassertions/fluentassertions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fluentassertions/fluentassertions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fluentassertions/fluentassertions/teams","hooks_url":"https://api.github.com/repos/fluentassertions/fluentassertions/hooks","issue_events_url":"https://api.github.com/repos/fluentassertions/fluentassertions/issues/events{/number}","events_url":"https://api.github.com/repos/fluentassertions/fluentassertions/events","assignees_url":"https://api.github.com/repos/fluentassertions/fluentassertions/assignees{/user}","branches_url":"https://api.github.com/repos/fluentassertions/fluentassertions/branches{/branch}","tags_url":"https://api.github.com/repos/fluentassertions/fluentassertions/tags","blobs_url":"https://api.github.com/repos/fluentassertions/fluentassertions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fluentassertions/fluentassertions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fluentassertions/fluentassertions/git/refs{/sha}","trees_url":"https://api.github.com/repos/fluentassertions/fluentassertions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fluentassertions/fluentassertions/statuses/{sha}","languages_url":"https://api.github.com/repos/fluentassertions/fluentassertions/languages","stargazers_url":"https://api.github.com/repos/fluentassertions/fluentassertions/stargazers","contributors_url":"https://api.github.com/repos/fluentassertions/fluentassertions/contributors","subscribers_url":"https://api.github.com/repos/fluentassertions/fluentassertions/subscribers","subscription_url":"https://api.github.com/repos/fluentassertions/fluentassertions/subscription","commits_url":"https://api.github.com/repos/fluentassertions/fluentassertions/commits{/sha}","git_commits_url":"https://api.github.com/repos/fluentassertions/fluentassertions/git/commits{/sha}","comments_url":"https://api.github.com/repos/fluentassertions/fluentassertions/comments{/number}","issue_comment_url":"https://api.github.com/repos/fluentassertions/fluentassertions/issues/comments{/number}","contents_url":"https://api.github.com/repos/fluentassertions/fluentassertions/contents/{+path}","compare_url":"https://api.github.com/repos/fluentassertions/fluentassertions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fluentassertions/fluentassertions/merges","archive_url":"https://api.github.com/repos/fluentassertions/fluentassertions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fluentassertions/fluentassertions/downloads","issues_url":"https://api.github.com/repos/fluentassertions/fluentassertions/issues{/number}","pulls_url":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls{/number}","milestones_url":"https://api.github.com/repos/fluentassertions/fluentassertions/milestones{/number}","notifications_url":"https://api.github.com/repos/fluentassertions/fluentassertions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fluentassertions/fluentassertions/labels{/name}","releases_url":"https://api.github.com/repos/fluentassertions/fluentassertions/releases{/id}","deployments_url":"https://api.github.com/repos/fluentassertions/fluentassertions/deployments","created_at":"2013-07-28T10:35:25Z","updated_at":"2018-03-18T03:19:31Z","pushed_at":"2018-03-18T17:19:23Z","git_url":"git://github.com/fluentassertions/fluentassertions.git","ssh_url":"git@github.com:fluentassertions/fluentassertions.git","clone_url":"https://github.com/fluentassertions/fluentassertions.git","svn_url":"https://github.com/fluentassertions/fluentassertions","homepage":"http://www.fluentassertions.com","size":21310,"stargazers_count":1046,"watchers_count":1046,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":245,"mirror_url":null,"archived":false,"open_issues_count":78,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":245,"open_issues":78,"watchers":1046,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804"},"html":{"href":"https://github.com/fluentassertions/fluentassertions/pull/804"},"issue":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/issues/804"},"comments":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/issues/804/comments"},"review_comments":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804/comments"},"review_comment":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/pulls/804/commits"},"statuses":{"href":"https://api.github.com/repos/fluentassertions/fluentassertions/statuses/b8f56b2d26925f21766a6fd5659e637e83ca4f66"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jnyrup"}}