{"action":"created","comment":{"url":"https://api.github.com/repos/mono/mono/pulls/comments/85840031","pull_request_review_id":6531833,"id":85840031,"diff_hunk":"@@ -1840,26 +1841,77 @@ mono_assembly_load_friends (MonoAssembly* ass)\n gboolean\n mono_assembly_has_reference_assembly_attribute (MonoAssembly *assembly, MonoError *error)\n {\n+\tMonoImage *image;\n+\tguint32 mtoken, i;\n+\tguint32 cols [MONO_CUSTOM_ATTR_SIZE];\n+\tMonoTableInfo *ca;\n+\tguint32 idx;\n+\n \tmono_error_init (error);\n \n-/* TODO: mono_custom_attrs_from_assembly_checked returns NULL if a\n- * single assembly is missing.  The custom attr we want is from\n- * corlib, however, so we need a more robust version that doesn't care\n- * about missing attributes.\n- */\n-#if 1\n-\tMonoCustomAttrInfo *attrs = mono_custom_attrs_from_assembly_checked (assembly, TRUE, error);\n-\treturn_val_if_nok (error, FALSE);\n-\tif (!attrs)\n+\t/*\n+\t * This might be called during assembly loading, so do everything using the low-level\n+\t * metadata APIs.\n+\t */\n+\n+\timage = assembly->image;\n+\tidx = 1; /* there is only one assembly */\n+\tidx <<= MONO_CUSTOM_ATTR_BITS;\n+\tidx |= MONO_CUSTOM_ATTR_ASSEMBLY;\n+\n+\t/* Inlined from mono_custom_attrs_from_index_checked () */\n+\tca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE];\n+\ti = mono_metadata_custom_attrs_from_index (image, idx);\n+\tif (!i)\n \t\treturn FALSE;\n-\tMonoClass *ref_asm_class = mono_class_try_get_reference_assembly_class ();\n-\tg_assert (ref_asm_class != NULL && ref_asm_class != mono_defaults.object_class && !strcmp(ref_asm_class->name, \"ReferenceAssemblyAttribute\") );\n-\tgboolean result = mono_custom_attrs_has_attr (attrs, ref_asm_class);\n-\tmono_custom_attrs_free (attrs);\n-\treturn result;\n-#else\n+\ti --;\n+\twhile (i < ca->rows) {\n+\t\tif (mono_metadata_decode_row_col (ca, i, MONO_CUSTOM_ATTR_PARENT) != idx)\n+\t\t\tbreak;\n+\t\tmono_metadata_decode_row (ca, i, cols, MONO_CUSTOM_ATTR_SIZE);\n+\t\ti ++;\n+\t\tmtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;\n+\t\tif ((cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) != MONO_CUSTOM_ATTR_TYPE_MEMBERREF)\n+\t\t\tcontinue;\n+\t\tmtoken |= MONO_TOKEN_MEMBER_REF;\n+\t\t{\n+\t\t\t/* method_from_memberref () */\n+\t\t\tguint32 cols[6];\n+\t\t\tguint32 nindex, class_index;\n+\n+\t\t\tint idx = mono_metadata_token_index (mtoken);\n+\n+\t\t\tmono_metadata_decode_row (&image->tables [MONO_TABLE_MEMBERREF], idx-1, cols, 3);\n+\t\t\tnindex = cols [MONO_MEMBERREF_CLASS] >> MONO_MEMBERREF_PARENT_BITS;\n+\t\t\tclass_index = cols [MONO_MEMBERREF_CLASS] & MONO_MEMBERREF_PARENT_MASK;\n+\t\t\tif (class_index == MONO_MEMBERREF_PARENT_TYPEREF) {\n+\t\t\t\tguint32 type_token = MONO_TOKEN_TYPE_REF | nindex;\n+\t\t\t\t/* mono_class_from_typeref_checked () */\n+\t\t\t\t{\n+\t\t\t\t\tguint32 cols [MONO_TYPEREF_SIZE];\n+\t\t\t\t\tconst char *name, *nspace;\n+\t\t\t\t\tMonoTableInfo  *t = &image->tables [MONO_TABLE_TYPEREF];\n+\t\t\t\t\tguint32 idx;\n+\n+\t\t\t\t\tmono_metadata_decode_row (t, (type_token&0xffffff)-1, cols, MONO_TYPEREF_SIZE);\n+\n+\t\t\t\t\tname = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);\n+\t\t\t\t\tnspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);\n+\t\t\t\t\tidx = cols [MONO_TYPEREF_SCOPE] >> MONO_RESOLUTION_SCOPE_BITS;\n+\n+\t\t\t\t\tif (!strcmp (name, \"ReferenceAssemblyAttribute\") && !strcmp (nspace, \"System.Runtime.CompilerServices\")) {\n+\t\t\t\t\t\tif ((cols [MONO_TYPEREF_SCOPE] & MONO_RESOLUTION_SCOPE_MASK) == MONO_RESOLUTION_SCOPE_ASSEMBLYREF) {\n+\t\t\t\t\t\t\tMonoAssemblyName aname;\n+\t\t\t\t\t\t\tmono_assembly_get_assemblyref (image, idx - 1, &aname);\n+\t\t\t\t\t\t\tif (!strcmp (aname.name, \"System.Runtime\"))","path":"mono/metadata/assembly.c","position":89,"original_position":89,"commit_id":"a21ee2f021a9fd80cdaada651d0f96b0a1b01323","original_commit_id":"a21ee2f021a9fd80cdaada651d0f96b0a1b01323","user":{"login":"vargaz","id":186301,"avatar_url":"https://avatars.githubusercontent.com/u/186301?v=3","gravatar_id":"","url":"https://api.github.com/users/vargaz","html_url":"https://github.com/vargaz","followers_url":"https://api.github.com/users/vargaz/followers","following_url":"https://api.github.com/users/vargaz/following{/other_user}","gists_url":"https://api.github.com/users/vargaz/gists{/gist_id}","starred_url":"https://api.github.com/users/vargaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vargaz/subscriptions","organizations_url":"https://api.github.com/users/vargaz/orgs","repos_url":"https://api.github.com/users/vargaz/repos","events_url":"https://api.github.com/users/vargaz/events{/privacy}","received_events_url":"https://api.github.com/users/vargaz/received_events","type":"User","site_admin":false},"body":"The assembly actually references:\r\n.custom instance void [System.Runtime]System.Runtime.CompilerServices.ReferenceAssemblyAttribute::.ctor() = ( 01 00 00 00 ) ","created_at":"2016-10-31T21:45:17Z","updated_at":"2016-10-31T21:45:17Z","html_url":"https://github.com/mono/mono/pull/3862#discussion_r85840031","pull_request_url":"https://api.github.com/repos/mono/mono/pulls/3862","_links":{"self":{"href":"https://api.github.com/repos/mono/mono/pulls/comments/85840031"},"html":{"href":"https://github.com/mono/mono/pull/3862#discussion_r85840031"},"pull_request":{"href":"https://api.github.com/repos/mono/mono/pulls/3862"}}},"pull_request":{"url":"https://api.github.com/repos/mono/mono/pulls/3862","id":91691910,"html_url":"https://github.com/mono/mono/pull/3862","diff_url":"https://github.com/mono/mono/pull/3862.diff","patch_url":"https://github.com/mono/mono/pull/3862.patch","issue_url":"https://api.github.com/repos/mono/mono/issues/3862","number":3862,"state":"open","locked":false,"title":"[runtime] Perform the reference assembly attribute check using the lo…","user":{"login":"vargaz","id":186301,"avatar_url":"https://avatars.githubusercontent.com/u/186301?v=3","gravatar_id":"","url":"https://api.github.com/users/vargaz","html_url":"https://github.com/vargaz","followers_url":"https://api.github.com/users/vargaz/followers","following_url":"https://api.github.com/users/vargaz/following{/other_user}","gists_url":"https://api.github.com/users/vargaz/gists{/gist_id}","starred_url":"https://api.github.com/users/vargaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vargaz/subscriptions","organizations_url":"https://api.github.com/users/vargaz/orgs","repos_url":"https://api.github.com/users/vargaz/repos","events_url":"https://api.github.com/users/vargaz/events{/privacy}","received_events_url":"https://api.github.com/users/vargaz/received_events","type":"User","site_admin":false},"body":"…w level metadata apis outside of a lock.","created_at":"2016-10-31T21:14:15Z","updated_at":"2016-10-31T21:45:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ab412c10fabdbadcae56b67338715c8cf9de8fe","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mono/mono/pulls/3862/commits","review_comments_url":"https://api.github.com/repos/mono/mono/pulls/3862/comments","review_comment_url":"https://api.github.com/repos/mono/mono/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mono/mono/issues/3862/comments","statuses_url":"https://api.github.com/repos/mono/mono/statuses/a21ee2f021a9fd80cdaada651d0f96b0a1b01323","head":{"label":"vargaz:ref-assembly-check","ref":"ref-assembly-check","sha":"a21ee2f021a9fd80cdaada651d0f96b0a1b01323","user":{"login":"vargaz","id":186301,"avatar_url":"https://avatars.githubusercontent.com/u/186301?v=3","gravatar_id":"","url":"https://api.github.com/users/vargaz","html_url":"https://github.com/vargaz","followers_url":"https://api.github.com/users/vargaz/followers","following_url":"https://api.github.com/users/vargaz/following{/other_user}","gists_url":"https://api.github.com/users/vargaz/gists{/gist_id}","starred_url":"https://api.github.com/users/vargaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vargaz/subscriptions","organizations_url":"https://api.github.com/users/vargaz/orgs","repos_url":"https://api.github.com/users/vargaz/repos","events_url":"https://api.github.com/users/vargaz/events{/privacy}","received_events_url":"https://api.github.com/users/vargaz/received_events","type":"User","site_admin":false},"repo":{"id":826761,"name":"mono","full_name":"vargaz/mono","owner":{"login":"vargaz","id":186301,"avatar_url":"https://avatars.githubusercontent.com/u/186301?v=3","gravatar_id":"","url":"https://api.github.com/users/vargaz","html_url":"https://github.com/vargaz","followers_url":"https://api.github.com/users/vargaz/followers","following_url":"https://api.github.com/users/vargaz/following{/other_user}","gists_url":"https://api.github.com/users/vargaz/gists{/gist_id}","starred_url":"https://api.github.com/users/vargaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vargaz/subscriptions","organizations_url":"https://api.github.com/users/vargaz/orgs","repos_url":"https://api.github.com/users/vargaz/repos","events_url":"https://api.github.com/users/vargaz/events{/privacy}","received_events_url":"https://api.github.com/users/vargaz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vargaz/mono","description":"Mono open source ECMA CLI, C# and .NET implementation.","fork":true,"url":"https://api.github.com/repos/vargaz/mono","forks_url":"https://api.github.com/repos/vargaz/mono/forks","keys_url":"https://api.github.com/repos/vargaz/mono/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vargaz/mono/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vargaz/mono/teams","hooks_url":"https://api.github.com/repos/vargaz/mono/hooks","issue_events_url":"https://api.github.com/repos/vargaz/mono/issues/events{/number}","events_url":"https://api.github.com/repos/vargaz/mono/events","assignees_url":"https://api.github.com/repos/vargaz/mono/assignees{/user}","branches_url":"https://api.github.com/repos/vargaz/mono/branches{/branch}","tags_url":"https://api.github.com/repos/vargaz/mono/tags","blobs_url":"https://api.github.com/repos/vargaz/mono/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vargaz/mono/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vargaz/mono/git/refs{/sha}","trees_url":"https://api.github.com/repos/vargaz/mono/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vargaz/mono/statuses/{sha}","languages_url":"https://api.github.com/repos/vargaz/mono/languages","stargazers_url":"https://api.github.com/repos/vargaz/mono/stargazers","contributors_url":"https://api.github.com/repos/vargaz/mono/contributors","subscribers_url":"https://api.github.com/repos/vargaz/mono/subscribers","subscription_url":"https://api.github.com/repos/vargaz/mono/subscription","commits_url":"https://api.github.com/repos/vargaz/mono/commits{/sha}","git_commits_url":"https://api.github.com/repos/vargaz/mono/git/commits{/sha}","comments_url":"https://api.github.com/repos/vargaz/mono/comments{/number}","issue_comment_url":"https://api.github.com/repos/vargaz/mono/issues/comments{/number}","contents_url":"https://api.github.com/repos/vargaz/mono/contents/{+path}","compare_url":"https://api.github.com/repos/vargaz/mono/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vargaz/mono/merges","archive_url":"https://api.github.com/repos/vargaz/mono/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vargaz/mono/downloads","issues_url":"https://api.github.com/repos/vargaz/mono/issues{/number}","pulls_url":"https://api.github.com/repos/vargaz/mono/pulls{/number}","milestones_url":"https://api.github.com/repos/vargaz/mono/milestones{/number}","notifications_url":"https://api.github.com/repos/vargaz/mono/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vargaz/mono/labels{/name}","releases_url":"https://api.github.com/repos/vargaz/mono/releases{/id}","deployments_url":"https://api.github.com/repos/vargaz/mono/deployments","created_at":"2010-08-09T15:56:23Z","updated_at":"2015-07-28T17:13:34Z","pushed_at":"2016-10-31T21:13:57Z","git_url":"git://github.com/vargaz/mono.git","ssh_url":"git@github.com:vargaz/mono.git","clone_url":"https://github.com/vargaz/mono.git","svn_url":"https://github.com/vargaz/mono","homepage":"http://www.mono-project.com/","size":407746,"stargazers_count":2,"watchers_count":2,"language":"C#","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"mono:master","ref":"master","sha":"758b80e35c027dcba36cefea46cbc7e878e0fe4b","user":{"login":"mono","id":53395,"avatar_url":"https://avatars.githubusercontent.com/u/53395?v=3","gravatar_id":"","url":"https://api.github.com/users/mono","html_url":"https://github.com/mono","followers_url":"https://api.github.com/users/mono/followers","following_url":"https://api.github.com/users/mono/following{/other_user}","gists_url":"https://api.github.com/users/mono/gists{/gist_id}","starred_url":"https://api.github.com/users/mono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mono/subscriptions","organizations_url":"https://api.github.com/users/mono/orgs","repos_url":"https://api.github.com/users/mono/repos","events_url":"https://api.github.com/users/mono/events{/privacy}","received_events_url":"https://api.github.com/users/mono/received_events","type":"Organization","site_admin":false},"repo":{"id":791611,"name":"mono","full_name":"mono/mono","owner":{"login":"mono","id":53395,"avatar_url":"https://avatars.githubusercontent.com/u/53395?v=3","gravatar_id":"","url":"https://api.github.com/users/mono","html_url":"https://github.com/mono","followers_url":"https://api.github.com/users/mono/followers","following_url":"https://api.github.com/users/mono/following{/other_user}","gists_url":"https://api.github.com/users/mono/gists{/gist_id}","starred_url":"https://api.github.com/users/mono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mono/subscriptions","organizations_url":"https://api.github.com/users/mono/orgs","repos_url":"https://api.github.com/users/mono/repos","events_url":"https://api.github.com/users/mono/events{/privacy}","received_events_url":"https://api.github.com/users/mono/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mono/mono","description":"Mono open source ECMA CLI, C# and .NET implementation.","fork":false,"url":"https://api.github.com/repos/mono/mono","forks_url":"https://api.github.com/repos/mono/mono/forks","keys_url":"https://api.github.com/repos/mono/mono/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mono/mono/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mono/mono/teams","hooks_url":"https://api.github.com/repos/mono/mono/hooks","issue_events_url":"https://api.github.com/repos/mono/mono/issues/events{/number}","events_url":"https://api.github.com/repos/mono/mono/events","assignees_url":"https://api.github.com/repos/mono/mono/assignees{/user}","branches_url":"https://api.github.com/repos/mono/mono/branches{/branch}","tags_url":"https://api.github.com/repos/mono/mono/tags","blobs_url":"https://api.github.com/repos/mono/mono/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mono/mono/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mono/mono/git/refs{/sha}","trees_url":"https://api.github.com/repos/mono/mono/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mono/mono/statuses/{sha}","languages_url":"https://api.github.com/repos/mono/mono/languages","stargazers_url":"https://api.github.com/repos/mono/mono/stargazers","contributors_url":"https://api.github.com/repos/mono/mono/contributors","subscribers_url":"https://api.github.com/repos/mono/mono/subscribers","subscription_url":"https://api.github.com/repos/mono/mono/subscription","commits_url":"https://api.github.com/repos/mono/mono/commits{/sha}","git_commits_url":"https://api.github.com/repos/mono/mono/git/commits{/sha}","comments_url":"https://api.github.com/repos/mono/mono/comments{/number}","issue_comment_url":"https://api.github.com/repos/mono/mono/issues/comments{/number}","contents_url":"https://api.github.com/repos/mono/mono/contents/{+path}","compare_url":"https://api.github.com/repos/mono/mono/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mono/mono/merges","archive_url":"https://api.github.com/repos/mono/mono/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mono/mono/downloads","issues_url":"https://api.github.com/repos/mono/mono/issues{/number}","pulls_url":"https://api.github.com/repos/mono/mono/pulls{/number}","milestones_url":"https://api.github.com/repos/mono/mono/milestones{/number}","notifications_url":"https://api.github.com/repos/mono/mono/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mono/mono/labels{/name}","releases_url":"https://api.github.com/repos/mono/mono/releases{/id}","deployments_url":"https://api.github.com/repos/mono/mono/deployments","created_at":"2010-07-22T18:06:36Z","updated_at":"2016-10-31T07:59:23Z","pushed_at":"2016-10-31T21:14:15Z","git_url":"git://github.com/mono/mono.git","ssh_url":"git@github.com:mono/mono.git","clone_url":"https://github.com/mono/mono.git","svn_url":"https://github.com/mono/mono","homepage":"http://www.mono-project.com/","size":509126,"stargazers_count":5006,"watchers_count":5006,"language":"C#","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2391,"mirror_url":null,"open_issues_count":147,"forks":2391,"open_issues":147,"watchers":5006,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mono/mono/pulls/3862"},"html":{"href":"https://github.com/mono/mono/pull/3862"},"issue":{"href":"https://api.github.com/repos/mono/mono/issues/3862"},"comments":{"href":"https://api.github.com/repos/mono/mono/issues/3862/comments"},"review_comments":{"href":"https://api.github.com/repos/mono/mono/pulls/3862/comments"},"review_comment":{"href":"https://api.github.com/repos/mono/mono/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mono/mono/pulls/3862/commits"},"statuses":{"href":"https://api.github.com/repos/mono/mono/statuses/a21ee2f021a9fd80cdaada651d0f96b0a1b01323"}}}}
{"actor":{"display_login":"vargaz"}}