{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments/93301103","pull_request_review_id":13825815,"id":93301103,"diff_hunk":"@@ -216,7 +244,18 @@ - (HRESULT)_hresult {\n         return [hresultValue unsignedIntValue];\n     }\n \n-    TraceWarning(L\"NSException\", L\"Called -hresult on an NSException without an HRESULT!\");\n-    return E_UNEXPECTED;\n+    return [[self class] _HRESULTForExceptionName:self.name];\n+}\n+\n+- (void)_processException {\n+    HRESULT hr = [self _hresult];\n+    HSTRING_HEADER header;\n+    HSTRING hsReason = nullptr;\n+    \n+    if(self.reason != nil) {\n+        LPCWSTR reason = (LPCWSTR)([[self reason] cStringUsingEncoding:NSUnicodeStringEncoding]);\n+        WindowsCreateStringReference(reason, wcslen(reason), &header, &hsReason);","path":"Frameworks/Foundation/NSException.mm","position":58,"original_position":58,"commit_id":"145860924377e30d78744d43b781f177c15ef976","original_commit_id":"145860924377e30d78744d43b781f177c15ef976","user":{"login":"bbowman","id":15642573,"avatar_url":"https://avatars.githubusercontent.com/u/15642573?v=3","gravatar_id":"","url":"https://api.github.com/users/bbowman","html_url":"https://github.com/bbowman","followers_url":"https://api.github.com/users/bbowman/followers","following_url":"https://api.github.com/users/bbowman/following{/other_user}","gists_url":"https://api.github.com/users/bbowman/gists{/gist_id}","starred_url":"https://api.github.com/users/bbowman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbowman/subscriptions","organizations_url":"https://api.github.com/users/bbowman/orgs","repos_url":"https://api.github.com/users/bbowman/repos","events_url":"https://api.github.com/users/bbowman/events{/privacy}","received_events_url":"https://api.github.com/users/bbowman/received_events","type":"User","site_admin":false},"body":"The \"jist\" of it is that you should be using **Wrappers::HStringReference** instead of manually creating one and having to worry about its lifetime. \r\n\r\nI totally understand that \"reason\" is the backing store but that then begs the question of why don't need to delete the HSTRING that is presumably pointing to it. The interesting bit is the HEADER that is on the stack and that under the covers that header is being cast to the output HSTRING hsReason. This means that the storage for the HSTRING itself is just the header on the stack. \r\n\r\nThe fact though that you had to read the remarks, and still weren't 100% certain what was going on here suggests that a lifetime managed object like the wrappers one will make the code more maintainable, less verbose, and all around more clear what you are intending. \r\n\r\n---\r\nIn reply to: [93299684](https://github.com/Microsoft/WinObjC/pull/1570#discussion_r93299684) [](ancestors = 93299684,93297284,93125423)","created_at":"2016-12-20T18:55:05Z","updated_at":"2016-12-20T18:55:05Z","html_url":"https://github.com/Microsoft/WinObjC/pull/1570#discussion_r93301103","pull_request_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments/93301103"},"html":{"href":"https://github.com/Microsoft/WinObjC/pull/1570#discussion_r93301103"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570","id":98293994,"html_url":"https://github.com/Microsoft/WinObjC/pull/1570","diff_url":"https://github.com/Microsoft/WinObjC/pull/1570.diff","patch_url":"https://github.com/Microsoft/WinObjC/pull/1570.patch","issue_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/1570","number":1570,"state":"open","locked":false,"title":"Getting more detailed error messages across ABI boundary.","user":{"login":"pradipd","id":14915188,"avatar_url":"https://avatars.githubusercontent.com/u/14915188?v=3","gravatar_id":"","url":"https://api.github.com/users/pradipd","html_url":"https://github.com/pradipd","followers_url":"https://api.github.com/users/pradipd/followers","following_url":"https://api.github.com/users/pradipd/following{/other_user}","gists_url":"https://api.github.com/users/pradipd/gists{/gist_id}","starred_url":"https://api.github.com/users/pradipd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pradipd/subscriptions","organizations_url":"https://api.github.com/users/pradipd/orgs","repos_url":"https://api.github.com/users/pradipd/repos","events_url":"https://api.github.com/users/pradipd/events{/privacy}","received_events_url":"https://api.github.com/users/pradipd/received_events","type":"User","site_admin":false},"body":"3 changes:\r\n1. Updated libobjc2.  Libobjc2 will call RoOriginateError to set IRestrictedErrorInfo on the thread.  This will provide more details for exceptions, that are converted to HRESULTSs as they cross the ABI boundary.\r\n\r\n2. Updated objc2winmd to add an exception guard around  calls into winrt component.\r\n\r\n3. Modified NSException _hresult to convert some NSException's to HRESULTs.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/microsoft/winobjc/1570)\n<!-- Reviewable:end -->\n","created_at":"2016-12-16T08:16:12Z","updated_at":"2016-12-20T18:55:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9aa10ac3a4e54891997c2476a251c13662ce631","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570/commits","review_comments_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570/comments","review_comment_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/1570/comments","statuses_url":"https://api.github.com/repos/Microsoft/WinObjC/statuses/145860924377e30d78744d43b781f177c15ef976","head":{"label":"pradipd:develop","ref":"develop","sha":"145860924377e30d78744d43b781f177c15ef976","user":{"login":"pradipd","id":14915188,"avatar_url":"https://avatars.githubusercontent.com/u/14915188?v=3","gravatar_id":"","url":"https://api.github.com/users/pradipd","html_url":"https://github.com/pradipd","followers_url":"https://api.github.com/users/pradipd/followers","following_url":"https://api.github.com/users/pradipd/following{/other_user}","gists_url":"https://api.github.com/users/pradipd/gists{/gist_id}","starred_url":"https://api.github.com/users/pradipd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pradipd/subscriptions","organizations_url":"https://api.github.com/users/pradipd/orgs","repos_url":"https://api.github.com/users/pradipd/repos","events_url":"https://api.github.com/users/pradipd/events{/privacy}","received_events_url":"https://api.github.com/users/pradipd/received_events","type":"User","site_admin":false},"repo":{"id":70012349,"name":"WinObjC","full_name":"pradipd/WinObjC","owner":{"login":"pradipd","id":14915188,"avatar_url":"https://avatars.githubusercontent.com/u/14915188?v=3","gravatar_id":"","url":"https://api.github.com/users/pradipd","html_url":"https://github.com/pradipd","followers_url":"https://api.github.com/users/pradipd/followers","following_url":"https://api.github.com/users/pradipd/following{/other_user}","gists_url":"https://api.github.com/users/pradipd/gists{/gist_id}","starred_url":"https://api.github.com/users/pradipd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pradipd/subscriptions","organizations_url":"https://api.github.com/users/pradipd/orgs","repos_url":"https://api.github.com/users/pradipd/repos","events_url":"https://api.github.com/users/pradipd/events{/privacy}","received_events_url":"https://api.github.com/users/pradipd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pradipd/WinObjC","description":"Objective-C for Windows","fork":true,"url":"https://api.github.com/repos/pradipd/WinObjC","forks_url":"https://api.github.com/repos/pradipd/WinObjC/forks","keys_url":"https://api.github.com/repos/pradipd/WinObjC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pradipd/WinObjC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pradipd/WinObjC/teams","hooks_url":"https://api.github.com/repos/pradipd/WinObjC/hooks","issue_events_url":"https://api.github.com/repos/pradipd/WinObjC/issues/events{/number}","events_url":"https://api.github.com/repos/pradipd/WinObjC/events","assignees_url":"https://api.github.com/repos/pradipd/WinObjC/assignees{/user}","branches_url":"https://api.github.com/repos/pradipd/WinObjC/branches{/branch}","tags_url":"https://api.github.com/repos/pradipd/WinObjC/tags","blobs_url":"https://api.github.com/repos/pradipd/WinObjC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pradipd/WinObjC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pradipd/WinObjC/git/refs{/sha}","trees_url":"https://api.github.com/repos/pradipd/WinObjC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pradipd/WinObjC/statuses/{sha}","languages_url":"https://api.github.com/repos/pradipd/WinObjC/languages","stargazers_url":"https://api.github.com/repos/pradipd/WinObjC/stargazers","contributors_url":"https://api.github.com/repos/pradipd/WinObjC/contributors","subscribers_url":"https://api.github.com/repos/pradipd/WinObjC/subscribers","subscription_url":"https://api.github.com/repos/pradipd/WinObjC/subscription","commits_url":"https://api.github.com/repos/pradipd/WinObjC/commits{/sha}","git_commits_url":"https://api.github.com/repos/pradipd/WinObjC/git/commits{/sha}","comments_url":"https://api.github.com/repos/pradipd/WinObjC/comments{/number}","issue_comment_url":"https://api.github.com/repos/pradipd/WinObjC/issues/comments{/number}","contents_url":"https://api.github.com/repos/pradipd/WinObjC/contents/{+path}","compare_url":"https://api.github.com/repos/pradipd/WinObjC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pradipd/WinObjC/merges","archive_url":"https://api.github.com/repos/pradipd/WinObjC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pradipd/WinObjC/downloads","issues_url":"https://api.github.com/repos/pradipd/WinObjC/issues{/number}","pulls_url":"https://api.github.com/repos/pradipd/WinObjC/pulls{/number}","milestones_url":"https://api.github.com/repos/pradipd/WinObjC/milestones{/number}","notifications_url":"https://api.github.com/repos/pradipd/WinObjC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pradipd/WinObjC/labels{/name}","releases_url":"https://api.github.com/repos/pradipd/WinObjC/releases{/id}","deployments_url":"https://api.github.com/repos/pradipd/WinObjC/deployments","created_at":"2016-10-04T22:41:22Z","updated_at":"2016-10-26T22:21:26Z","pushed_at":"2016-12-19T06:28:14Z","git_url":"git://github.com/pradipd/WinObjC.git","ssh_url":"git@github.com:pradipd/WinObjC.git","clone_url":"https://github.com/pradipd/WinObjC.git","svn_url":"https://github.com/pradipd/WinObjC","homepage":"","size":335124,"stargazers_count":1,"watchers_count":1,"language":"Objective-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":1,"default_branch":"develop"}},"base":{"label":"Microsoft:develop","ref":"develop","sha":"3de7a98233bed532030fc452d2483cb062a533e8","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":37950166,"name":"WinObjC","full_name":"Microsoft/WinObjC","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/WinObjC","description":"Objective-C for Windows","fork":false,"url":"https://api.github.com/repos/Microsoft/WinObjC","forks_url":"https://api.github.com/repos/Microsoft/WinObjC/forks","keys_url":"https://api.github.com/repos/Microsoft/WinObjC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/WinObjC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/WinObjC/teams","hooks_url":"https://api.github.com/repos/Microsoft/WinObjC/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/WinObjC/events","assignees_url":"https://api.github.com/repos/Microsoft/WinObjC/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/WinObjC/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/WinObjC/tags","blobs_url":"https://api.github.com/repos/Microsoft/WinObjC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/WinObjC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/WinObjC/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/WinObjC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/WinObjC/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/WinObjC/languages","stargazers_url":"https://api.github.com/repos/Microsoft/WinObjC/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/WinObjC/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/WinObjC/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/WinObjC/subscription","commits_url":"https://api.github.com/repos/Microsoft/WinObjC/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/WinObjC/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/WinObjC/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/WinObjC/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/WinObjC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/WinObjC/merges","archive_url":"https://api.github.com/repos/Microsoft/WinObjC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/WinObjC/downloads","issues_url":"https://api.github.com/repos/Microsoft/WinObjC/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/WinObjC/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/WinObjC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/WinObjC/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/WinObjC/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/WinObjC/deployments","created_at":"2015-06-23T23:14:58Z","updated_at":"2016-12-19T21:59:45Z","pushed_at":"2016-12-20T18:36:22Z","git_url":"git://github.com/Microsoft/WinObjC.git","ssh_url":"git@github.com:Microsoft/WinObjC.git","clone_url":"https://github.com/Microsoft/WinObjC.git","svn_url":"https://github.com/Microsoft/WinObjC","homepage":"","size":375413,"stargazers_count":5549,"watchers_count":5549,"language":"Objective-C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":739,"mirror_url":null,"open_issues_count":307,"forks":739,"open_issues":307,"watchers":5549,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570"},"html":{"href":"https://github.com/Microsoft/WinObjC/pull/1570"},"issue":{"href":"https://api.github.com/repos/Microsoft/WinObjC/issues/1570"},"comments":{"href":"https://api.github.com/repos/Microsoft/WinObjC/issues/1570/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/1570/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/WinObjC/statuses/145860924377e30d78744d43b781f177c15ef976"}}}}
{"actor":{"display_login":"bbowman"}}