{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/symreader-portable/pulls/comments/71262263","id":71262263,"diff_hunk":"@@ -136,9 +144,50 @@ public int GetSourceLength(out int length)\n             out int count,\n             [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4), Out]byte[] source)\n         {\n-            // SymReader doesn't support embedded source.\n             count = 0;\n-            return HResult.E_NOTIMPL;\n+\n+            // This function used to return E_NOTIMPL in all implementations. When filling in the\n+            // implementation, it was deemed not very useful and impractical to actually decompress\n+            // and decode text and interpret lines and columns here. A convention was adopted that \n+            // (0, 0, >= int.MaxValue, >= int.MaxValue) is a maximal range indicating that all\n+            // source bytes should be returned. Anything else is rejected as invalid. This matches \n+            // the new native behavior.\n+            if (startLine != 0 || \n+                startColumn != 0 ||\n+                unchecked((uint)endLine) < int.MaxValue ||\n+                unchecked((uint)endColumn) < int.MaxValue)\n+            {\n+                return HResult.E_INVALIDARG;\n+            }\n+\n+            if (bufferLength < 0)\n+            {\n+                return HResult.E_INVALIDARG;\n+            }\n+\n+            if (source == null && bufferLength > 0)\n+            {\n+                return HResult.E_INVALIDARG;\n+            }\n+\n+            BlobReader reader;\n+            int hr = GetEmbeddedSourceBlobReader(out reader);\n+            if (hr != HResult.S_OK)\n+            {\n+                return hr;\n+            }\n+\n+            count = Math.Min(bufferLength, reader.RemainingBytes);\n+            if (count > 0)\n+            {\n+                // There is not currently a mechanism for reading from BlobReader to existing byte[]\n+                // https://github.com/dotnet/corefx/issues/8004 tracks adding that API to corefx and\n+                // this should be updated to use that when it's fixed. In the meantime, we are forced\n+                // to make an extra copy here.\n+                Array.Copy(reader.ReadBytes(count), source, count);","path":"src/Microsoft.DiaSymReader.PortablePdb/SymDocument.cs","position":66,"original_position":66,"commit_id":"477dfe28747d6416bec762721c2bbb16d7d057d0","original_commit_id":"477dfe28747d6416bec762721c2bbb16d7d057d0","user":{"login":"nguerrera","id":75470,"avatar_url":"https://avatars.githubusercontent.com/u/75470?v=3","gravatar_id":"","url":"https://api.github.com/users/nguerrera","html_url":"https://github.com/nguerrera","followers_url":"https://api.github.com/users/nguerrera/followers","following_url":"https://api.github.com/users/nguerrera/following{/other_user}","gists_url":"https://api.github.com/users/nguerrera/gists{/gist_id}","starred_url":"https://api.github.com/users/nguerrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguerrera/subscriptions","organizations_url":"https://api.github.com/users/nguerrera/orgs","repos_url":"https://api.github.com/users/nguerrera/repos","events_url":"https://api.github.com/users/nguerrera/events{/privacy}","received_events_url":"https://api.github.com/users/nguerrera/received_events","type":"User","site_admin":false},"body":"Sure. I'll send a PR.","created_at":"2016-07-19T02:01:37Z","updated_at":"2016-07-19T02:01:37Z","html_url":"https://github.com/dotnet/symreader-portable/pull/16#discussion_r71262263","pull_request_url":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/dotnet/symreader-portable/pulls/comments/71262263"},"html":{"href":"https://github.com/dotnet/symreader-portable/pull/16#discussion_r71262263"},"pull_request":{"href":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16","id":76647107,"html_url":"https://github.com/dotnet/symreader-portable/pull/16","diff_url":"https://github.com/dotnet/symreader-portable/pull/16.diff","patch_url":"https://github.com/dotnet/symreader-portable/pull/16.patch","issue_url":"https://api.github.com/repos/dotnet/symreader-portable/issues/16","number":16,"state":"open","locked":false,"title":"Support reading embedded source","user":{"login":"nguerrera","id":75470,"avatar_url":"https://avatars.githubusercontent.com/u/75470?v=3","gravatar_id":"","url":"https://api.github.com/users/nguerrera","html_url":"https://github.com/nguerrera","followers_url":"https://api.github.com/users/nguerrera/followers","following_url":"https://api.github.com/users/nguerrera/following{/other_user}","gists_url":"https://api.github.com/users/nguerrera/gists{/gist_id}","starred_url":"https://api.github.com/users/nguerrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguerrera/subscriptions","organizations_url":"https://api.github.com/users/nguerrera/orgs","repos_url":"https://api.github.com/users/nguerrera/repos","events_url":"https://api.github.com/users/nguerrera/events{/privacy}","received_events_url":"https://api.github.com/users/nguerrera/received_events","type":"User","site_admin":false},"body":"Moving pending changes from dotnet/roslyn#12353\r\n\r\n@tmat I'll start adding tests, but putting this up here now so I can resolve merge conflict in roslyn.","created_at":"2016-07-07T18:55:47Z","updated_at":"2016-07-19T02:01:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4470db4587fcd58336903312a733cecc1374228","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16/commits","review_comments_url":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16/comments","review_comment_url":"https://api.github.com/repos/dotnet/symreader-portable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/symreader-portable/issues/16/comments","statuses_url":"https://api.github.com/repos/dotnet/symreader-portable/statuses/477dfe28747d6416bec762721c2bbb16d7d057d0","head":{"label":"nguerrera:embed-source-in-pdb","ref":"embed-source-in-pdb","sha":"477dfe28747d6416bec762721c2bbb16d7d057d0","user":{"login":"nguerrera","id":75470,"avatar_url":"https://avatars.githubusercontent.com/u/75470?v=3","gravatar_id":"","url":"https://api.github.com/users/nguerrera","html_url":"https://github.com/nguerrera","followers_url":"https://api.github.com/users/nguerrera/followers","following_url":"https://api.github.com/users/nguerrera/following{/other_user}","gists_url":"https://api.github.com/users/nguerrera/gists{/gist_id}","starred_url":"https://api.github.com/users/nguerrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguerrera/subscriptions","organizations_url":"https://api.github.com/users/nguerrera/orgs","repos_url":"https://api.github.com/users/nguerrera/repos","events_url":"https://api.github.com/users/nguerrera/events{/privacy}","received_events_url":"https://api.github.com/users/nguerrera/received_events","type":"User","site_admin":false},"repo":{"id":62172963,"name":"symreader-portable","full_name":"nguerrera/symreader-portable","owner":{"login":"nguerrera","id":75470,"avatar_url":"https://avatars.githubusercontent.com/u/75470?v=3","gravatar_id":"","url":"https://api.github.com/users/nguerrera","html_url":"https://github.com/nguerrera","followers_url":"https://api.github.com/users/nguerrera/followers","following_url":"https://api.github.com/users/nguerrera/following{/other_user}","gists_url":"https://api.github.com/users/nguerrera/gists{/gist_id}","starred_url":"https://api.github.com/users/nguerrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguerrera/subscriptions","organizations_url":"https://api.github.com/users/nguerrera/orgs","repos_url":"https://api.github.com/users/nguerrera/repos","events_url":"https://api.github.com/users/nguerrera/events{/privacy}","received_events_url":"https://api.github.com/users/nguerrera/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguerrera/symreader-portable","description":null,"fork":true,"url":"https://api.github.com/repos/nguerrera/symreader-portable","forks_url":"https://api.github.com/repos/nguerrera/symreader-portable/forks","keys_url":"https://api.github.com/repos/nguerrera/symreader-portable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguerrera/symreader-portable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguerrera/symreader-portable/teams","hooks_url":"https://api.github.com/repos/nguerrera/symreader-portable/hooks","issue_events_url":"https://api.github.com/repos/nguerrera/symreader-portable/issues/events{/number}","events_url":"https://api.github.com/repos/nguerrera/symreader-portable/events","assignees_url":"https://api.github.com/repos/nguerrera/symreader-portable/assignees{/user}","branches_url":"https://api.github.com/repos/nguerrera/symreader-portable/branches{/branch}","tags_url":"https://api.github.com/repos/nguerrera/symreader-portable/tags","blobs_url":"https://api.github.com/repos/nguerrera/symreader-portable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguerrera/symreader-portable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguerrera/symreader-portable/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguerrera/symreader-portable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguerrera/symreader-portable/statuses/{sha}","languages_url":"https://api.github.com/repos/nguerrera/symreader-portable/languages","stargazers_url":"https://api.github.com/repos/nguerrera/symreader-portable/stargazers","contributors_url":"https://api.github.com/repos/nguerrera/symreader-portable/contributors","subscribers_url":"https://api.github.com/repos/nguerrera/symreader-portable/subscribers","subscription_url":"https://api.github.com/repos/nguerrera/symreader-portable/subscription","commits_url":"https://api.github.com/repos/nguerrera/symreader-portable/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguerrera/symreader-portable/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguerrera/symreader-portable/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguerrera/symreader-portable/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguerrera/symreader-portable/contents/{+path}","compare_url":"https://api.github.com/repos/nguerrera/symreader-portable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguerrera/symreader-portable/merges","archive_url":"https://api.github.com/repos/nguerrera/symreader-portable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguerrera/symreader-portable/downloads","issues_url":"https://api.github.com/repos/nguerrera/symreader-portable/issues{/number}","pulls_url":"https://api.github.com/repos/nguerrera/symreader-portable/pulls{/number}","milestones_url":"https://api.github.com/repos/nguerrera/symreader-portable/milestones{/number}","notifications_url":"https://api.github.com/repos/nguerrera/symreader-portable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguerrera/symreader-portable/labels{/name}","releases_url":"https://api.github.com/repos/nguerrera/symreader-portable/releases{/id}","deployments_url":"https://api.github.com/repos/nguerrera/symreader-portable/deployments","created_at":"2016-06-28T20:41:14Z","updated_at":"2016-06-28T20:41:16Z","pushed_at":"2016-07-13T23:40:19Z","git_url":"git://github.com/nguerrera/symreader-portable.git","ssh_url":"git@github.com:nguerrera/symreader-portable.git","clone_url":"https://github.com/nguerrera/symreader-portable.git","svn_url":"https://github.com/nguerrera/symreader-portable","homepage":null,"size":3014,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"519e24a34e33d5f5acbc263974890fc28bcc7d1d","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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":55531619,"name":"symreader-portable","full_name":"dotnet/symreader-portable","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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},"private":false,"html_url":"https://github.com/dotnet/symreader-portable","description":"Reader of Portable PDBs format that implements DiaSymReader interfaces (ISymUnmanagedReader, ISymUnmanagedBinder, etc.).","fork":false,"url":"https://api.github.com/repos/dotnet/symreader-portable","forks_url":"https://api.github.com/repos/dotnet/symreader-portable/forks","keys_url":"https://api.github.com/repos/dotnet/symreader-portable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/symreader-portable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/symreader-portable/teams","hooks_url":"https://api.github.com/repos/dotnet/symreader-portable/hooks","issue_events_url":"https://api.github.com/repos/dotnet/symreader-portable/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/symreader-portable/events","assignees_url":"https://api.github.com/repos/dotnet/symreader-portable/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/symreader-portable/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/symreader-portable/tags","blobs_url":"https://api.github.com/repos/dotnet/symreader-portable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/symreader-portable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/symreader-portable/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/symreader-portable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/symreader-portable/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/symreader-portable/languages","stargazers_url":"https://api.github.com/repos/dotnet/symreader-portable/stargazers","contributors_url":"https://api.github.com/repos/dotnet/symreader-portable/contributors","subscribers_url":"https://api.github.com/repos/dotnet/symreader-portable/subscribers","subscription_url":"https://api.github.com/repos/dotnet/symreader-portable/subscription","commits_url":"https://api.github.com/repos/dotnet/symreader-portable/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/symreader-portable/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/symreader-portable/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/symreader-portable/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/symreader-portable/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/symreader-portable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/symreader-portable/merges","archive_url":"https://api.github.com/repos/dotnet/symreader-portable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/symreader-portable/downloads","issues_url":"https://api.github.com/repos/dotnet/symreader-portable/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/symreader-portable/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/symreader-portable/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/symreader-portable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/symreader-portable/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/symreader-portable/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/symreader-portable/deployments","created_at":"2016-04-05T18:16:48Z","updated_at":"2016-07-01T16:53:41Z","pushed_at":"2016-07-19T01:28:27Z","git_url":"git://github.com/dotnet/symreader-portable.git","ssh_url":"git@github.com:dotnet/symreader-portable.git","clone_url":"https://github.com/dotnet/symreader-portable.git","svn_url":"https://github.com/dotnet/symreader-portable","homepage":"","size":3010,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16"},"html":{"href":"https://github.com/dotnet/symreader-portable/pull/16"},"issue":{"href":"https://api.github.com/repos/dotnet/symreader-portable/issues/16"},"comments":{"href":"https://api.github.com/repos/dotnet/symreader-portable/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/symreader-portable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/symreader-portable/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/symreader-portable/statuses/477dfe28747d6416bec762721c2bbb16d7d057d0"}}}}
{"actor":{"display_login":"nguerrera"}}