{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/222130084","pull_request_review_id":160946049,"id":222130084,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjEzMDA4NA==","diff_hunk":"@@ -1254,9 +1254,11 @@ BOOL IsFixedBuffer(mdFieldDef field, IMDInternalImport* pInternalImport, LONG* p\n     BYTE* pData;\n     LONG cData;\n \n-    HRESULT hr = pInternalImport->GetCustomAttributeByName(field, g_FixedBufferAttribute, (const VOID **)(&pData), (ULONG *)&cData);\n+    HRESULT hr;\n+\n+    IfFailGo(pInternalImport->GetCustomAttributeByName(field, g_FixedBufferAttribute, (const VOID **)(&pData), (ULONG *)&cData));\n \n-    if (SUCCEEDED(hr) && cData != 0)\n+    if (hr == S_OK && cData != 0)","path":"src/vm/fieldmarshaler.cpp","position":52,"original_position":10,"commit_id":"52364777655c6d849f94028c876153c4fc329338","original_commit_id":"aa6641c23987fa4943285001df707af469c9da87","user":{"login":"jkoritzinsky","id":1571408,"node_id":"MDQ6VXNlcjE1NzE0MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/1571408?v=4","gravatar_id":"","url":"https://api.github.com/users/jkoritzinsky","html_url":"https://github.com/jkoritzinsky","followers_url":"https://api.github.com/users/jkoritzinsky/followers","following_url":"https://api.github.com/users/jkoritzinsky/following{/other_user}","gists_url":"https://api.github.com/users/jkoritzinsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jkoritzinsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkoritzinsky/subscriptions","organizations_url":"https://api.github.com/users/jkoritzinsky/orgs","repos_url":"https://api.github.com/users/jkoritzinsky/repos","events_url":"https://api.github.com/users/jkoritzinsky/events{/privacy}","received_events_url":"https://api.github.com/users/jkoritzinsky/received_events","type":"User","site_admin":false},"body":"It was happening on the `KeyValuePair<TKey, TValue>` type if I remember correctly. Not sure why it was happening, but it would cause crossgen and the JIT to AV.","created_at":"2018-10-02T22:17:06Z","updated_at":"2018-10-02T22:17:06Z","html_url":"https://github.com/dotnet/coreclr/pull/20194#discussion_r222130084","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/20194","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/222130084"},"html":{"href":"https://github.com/dotnet/coreclr/pull/20194#discussion_r222130084"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20194"}},"in_reply_to_id":221785823},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/20194","id":219107467,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTA3NDY3","html_url":"https://github.com/dotnet/coreclr/pull/20194","diff_url":"https://github.com/dotnet/coreclr/pull/20194.diff","patch_url":"https://github.com/dotnet/coreclr/pull/20194.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/20194","number":20194,"state":"open","locked":false,"title":"Marshal fixed buffers by emulating the implied fields.","user":{"login":"jkoritzinsky","id":1571408,"node_id":"MDQ6VXNlcjE1NzE0MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/1571408?v=4","gravatar_id":"","url":"https://api.github.com/users/jkoritzinsky","html_url":"https://github.com/jkoritzinsky","followers_url":"https://api.github.com/users/jkoritzinsky/followers","following_url":"https://api.github.com/users/jkoritzinsky/following{/other_user}","gists_url":"https://api.github.com/users/jkoritzinsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jkoritzinsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkoritzinsky/subscriptions","organizations_url":"https://api.github.com/users/jkoritzinsky/orgs","repos_url":"https://api.github.com/users/jkoritzinsky/repos","events_url":"https://api.github.com/users/jkoritzinsky/events{/privacy}","received_events_url":"https://api.github.com/users/jkoritzinsky/received_events","type":"User","site_admin":false},"body":"In master, when a fixed buffer is marshaled as part of a non-blittable structure, the marshaling code treats the type of a fixed buffer field `fixed byte buffer[2]` as a regular structure. However, the custom structure generated for a fixed buffer field has only one field of the type of the buffer. See the IL below for an example:\r\n\r\n```\r\n.class nested public sequential ansi sealed beforefieldinit '<number2>e__FixedBuffer'\r\n\textends [System.Runtime]System.ValueType\r\n{\r\n\t.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (\r\n\t\t01 00 00 00\r\n\t)\r\n\t.custom instance void [System.Runtime]System.Runtime.CompilerServices.UnsafeValueTypeAttribute::.ctor() = (\r\n\t\t01 00 00 00\r\n\t)\r\n\t.pack 0\r\n\t.size 2\r\n\r\n\t// Fields\r\n\t.field public uint8 FixedElementField\r\n\r\n} // end of class <number2>e__FixedBuffer\r\n```\r\n\r\n\r\n So, when this member is marshaled as a regular structure only the first member is marshaled since technically it is the only member of the structure.\r\n As a result, the rest of the data is lost.\r\n\r\n\r\nThis PR adds a new marshaler for fixed buffer fields. This marshaler emulates the missing fields by re-using the field marshaler for the first element of the buffer on the memory location of the later elements.\r\n\r\nFixes #18521.","created_at":"2018-09-28T23:23:33Z","updated_at":"2018-10-02T22:17:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aba46c140ebbd2696821370137b7715967388ec5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":244582102,"node_id":"MDU6TGFiZWwyNDQ1ODIxMDI=","url":"https://api.github.com/repos/dotnet/coreclr/labels/area-Interop","name":"area-Interop","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/20194/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/20194/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/20194/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/52364777655c6d849f94028c876153c4fc329338","head":{"label":"jkoritzinsky:fixes/coreclr/18521","ref":"fixes/coreclr/18521","sha":"52364777655c6d849f94028c876153c4fc329338","user":{"login":"jkoritzinsky","id":1571408,"node_id":"MDQ6VXNlcjE1NzE0MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/1571408?v=4","gravatar_id":"","url":"https://api.github.com/users/jkoritzinsky","html_url":"https://github.com/jkoritzinsky","followers_url":"https://api.github.com/users/jkoritzinsky/followers","following_url":"https://api.github.com/users/jkoritzinsky/following{/other_user}","gists_url":"https://api.github.com/users/jkoritzinsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jkoritzinsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkoritzinsky/subscriptions","organizations_url":"https://api.github.com/users/jkoritzinsky/orgs","repos_url":"https://api.github.com/users/jkoritzinsky/repos","events_url":"https://api.github.com/users/jkoritzinsky/events{/privacy}","received_events_url":"https://api.github.com/users/jkoritzinsky/received_events","type":"User","site_admin":false},"repo":{"id":87342903,"node_id":"MDEwOlJlcG9zaXRvcnk4NzM0MjkwMw==","name":"coreclr","full_name":"jkoritzinsky/coreclr","private":false,"owner":{"login":"jkoritzinsky","id":1571408,"node_id":"MDQ6VXNlcjE1NzE0MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/1571408?v=4","gravatar_id":"","url":"https://api.github.com/users/jkoritzinsky","html_url":"https://github.com/jkoritzinsky","followers_url":"https://api.github.com/users/jkoritzinsky/followers","following_url":"https://api.github.com/users/jkoritzinsky/following{/other_user}","gists_url":"https://api.github.com/users/jkoritzinsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jkoritzinsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkoritzinsky/subscriptions","organizations_url":"https://api.github.com/users/jkoritzinsky/orgs","repos_url":"https://api.github.com/users/jkoritzinsky/repos","events_url":"https://api.github.com/users/jkoritzinsky/events{/privacy}","received_events_url":"https://api.github.com/users/jkoritzinsky/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jkoritzinsky/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/jkoritzinsky/coreclr","forks_url":"https://api.github.com/repos/jkoritzinsky/coreclr/forks","keys_url":"https://api.github.com/repos/jkoritzinsky/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jkoritzinsky/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jkoritzinsky/coreclr/teams","hooks_url":"https://api.github.com/repos/jkoritzinsky/coreclr/hooks","issue_events_url":"https://api.github.com/repos/jkoritzinsky/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/jkoritzinsky/coreclr/events","assignees_url":"https://api.github.com/repos/jkoritzinsky/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/jkoritzinsky/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/jkoritzinsky/coreclr/tags","blobs_url":"https://api.github.com/repos/jkoritzinsky/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jkoritzinsky/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jkoritzinsky/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/jkoritzinsky/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jkoritzinsky/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/jkoritzinsky/coreclr/languages","stargazers_url":"https://api.github.com/repos/jkoritzinsky/coreclr/stargazers","contributors_url":"https://api.github.com/repos/jkoritzinsky/coreclr/contributors","subscribers_url":"https://api.github.com/repos/jkoritzinsky/coreclr/subscribers","subscription_url":"https://api.github.com/repos/jkoritzinsky/coreclr/subscription","commits_url":"https://api.github.com/repos/jkoritzinsky/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/jkoritzinsky/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/jkoritzinsky/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/jkoritzinsky/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/jkoritzinsky/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/jkoritzinsky/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jkoritzinsky/coreclr/merges","archive_url":"https://api.github.com/repos/jkoritzinsky/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jkoritzinsky/coreclr/downloads","issues_url":"https://api.github.com/repos/jkoritzinsky/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/jkoritzinsky/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/jkoritzinsky/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/jkoritzinsky/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jkoritzinsky/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/jkoritzinsky/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/jkoritzinsky/coreclr/deployments","created_at":"2017-04-05T18:26:47Z","updated_at":"2018-10-02T22:10:57Z","pushed_at":"2018-10-02T22:09:39Z","git_url":"git://github.com/jkoritzinsky/coreclr.git","ssh_url":"git@github.com:jkoritzinsky/coreclr.git","clone_url":"https://github.com/jkoritzinsky/coreclr.git","svn_url":"https://github.com/jkoritzinsky/coreclr","homepage":"https://docs.microsoft.com/dotnet/","size":241210,"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":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"c6ef88d88fe8c95323247393c04e6b161da3bb0e","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"node_id":"MDEwOlJlcG9zaXRvcnkzMDA5Mjg5Mw==","name":"coreclr","full_name":"dotnet/coreclr","private":false,"owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called System.Private.Corelib (or mscorlib). It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2018-10-02T21:25:37Z","pushed_at":"2018-10-02T22:13:08Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"https://github.com/dotnet/core","size":244535,"stargazers_count":9989,"watchers_count":9989,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2455,"mirror_url":null,"archived":false,"open_issues_count":1909,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2455,"open_issues":1909,"watchers":9989,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20194"},"html":{"href":"https://github.com/dotnet/coreclr/pull/20194"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/20194"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/20194/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20194/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20194/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/52364777655c6d849f94028c876153c4fc329338"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jkoritzinsky"}}