{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/docs/issues/1803","repository_url":"https://api.github.com/repos/dotnet/docs","labels_url":"https://api.github.com/repos/dotnet/docs/issues/1803/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/docs/issues/1803/comments","events_url":"https://api.github.com/repos/dotnet/docs/issues/1803/events","html_url":"https://github.com/dotnet/docs/issues/1803","id":217287412,"number":1803,"title":"C# ref local and returns are not allowed on async methods","user":{"login":"BillWagner","id":493969,"avatar_url":"https://avatars1.githubusercontent.com/u/493969?v=3","gravatar_id":"","url":"https://api.github.com/users/BillWagner","html_url":"https://github.com/BillWagner","followers_url":"https://api.github.com/users/BillWagner/followers","following_url":"https://api.github.com/users/BillWagner/following{/other_user}","gists_url":"https://api.github.com/users/BillWagner/gists{/gist_id}","starred_url":"https://api.github.com/users/BillWagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BillWagner/subscriptions","organizations_url":"https://api.github.com/users/BillWagner/orgs","repos_url":"https://api.github.com/users/BillWagner/repos","events_url":"https://api.github.com/users/BillWagner/events{/privacy}","received_events_url":"https://api.github.com/users/BillWagner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"GuardRex","id":1622880,"avatar_url":"https://avatars2.githubusercontent.com/u/1622880?v=3","gravatar_id":"","url":"https://api.github.com/users/GuardRex","html_url":"https://github.com/GuardRex","followers_url":"https://api.github.com/users/GuardRex/followers","following_url":"https://api.github.com/users/GuardRex/following{/other_user}","gists_url":"https://api.github.com/users/GuardRex/gists{/gist_id}","starred_url":"https://api.github.com/users/GuardRex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuardRex/subscriptions","organizations_url":"https://api.github.com/users/GuardRex/orgs","repos_url":"https://api.github.com/users/GuardRex/repos","events_url":"https://api.github.com/users/GuardRex/events{/privacy}","received_events_url":"https://api.github.com/users/GuardRex/received_events","type":"User","site_admin":false},"assignees":[{"login":"GuardRex","id":1622880,"avatar_url":"https://avatars2.githubusercontent.com/u/1622880?v=3","gravatar_id":"","url":"https://api.github.com/users/GuardRex","html_url":"https://github.com/GuardRex","followers_url":"https://api.github.com/users/GuardRex/followers","following_url":"https://api.github.com/users/GuardRex/following{/other_user}","gists_url":"https://api.github.com/users/GuardRex/gists{/gist_id}","starred_url":"https://api.github.com/users/GuardRex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuardRex/subscriptions","organizations_url":"https://api.github.com/users/GuardRex/orgs","repos_url":"https://api.github.com/users/GuardRex/repos","events_url":"https://api.github.com/users/GuardRex/events{/privacy}","received_events_url":"https://api.github.com/users/GuardRex/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dotnet/docs/milestones/20","html_url":"https://github.com/dotnet/docs/milestone/20","labels_url":"https://api.github.com/repos/dotnet/docs/milestones/20/labels","id":2478129,"number":20,"title":"May 2017","description":"Issues committed to fix for May 2017\r\n","creator":{"login":"BillWagner","id":493969,"avatar_url":"https://avatars1.githubusercontent.com/u/493969?v=3","gravatar_id":"","url":"https://api.github.com/users/BillWagner","html_url":"https://github.com/BillWagner","followers_url":"https://api.github.com/users/BillWagner/followers","following_url":"https://api.github.com/users/BillWagner/following{/other_user}","gists_url":"https://api.github.com/users/BillWagner/gists{/gist_id}","starred_url":"https://api.github.com/users/BillWagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BillWagner/subscriptions","organizations_url":"https://api.github.com/users/BillWagner/orgs","repos_url":"https://api.github.com/users/BillWagner/repos","events_url":"https://api.github.com/users/BillWagner/events{/privacy}","received_events_url":"https://api.github.com/users/BillWagner/received_events","type":"User","site_admin":false},"open_issues":29,"closed_issues":3,"state":"open","created_at":"2017-04-24T20:07:58Z","updated_at":"2017-05-04T18:17:30Z","due_on":"2017-05-31T07:00:00Z","closed_at":null},"comments":0,"created_at":"2017-03-27T15:38:50Z","updated_at":"2017-05-04T19:25:17Z","closed_at":null,"body":"This follows the same logic as why ref and out arguments are not allowed on async methods, but we should state it explicitly in the \"what's new in C# 7\" topic, and where we describe the `ref` keyword.\r\n\r\n/cc @rpetrusha "},"comment":{"url":"https://api.github.com/repos/dotnet/docs/issues/comments/299284648","html_url":"https://github.com/dotnet/docs/issues/1803#issuecomment-299284648","issue_url":"https://api.github.com/repos/dotnet/docs/issues/1803","id":299284648,"user":{"login":"GuardRex","id":1622880,"avatar_url":"https://avatars2.githubusercontent.com/u/1622880?v=3","gravatar_id":"","url":"https://api.github.com/users/GuardRex","html_url":"https://github.com/GuardRex","followers_url":"https://api.github.com/users/GuardRex/followers","following_url":"https://api.github.com/users/GuardRex/following{/other_user}","gists_url":"https://api.github.com/users/GuardRex/gists{/gist_id}","starred_url":"https://api.github.com/users/GuardRex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuardRex/subscriptions","organizations_url":"https://api.github.com/users/GuardRex/orgs","repos_url":"https://api.github.com/users/GuardRex/repos","events_url":"https://api.github.com/users/GuardRex/events{/privacy}","received_events_url":"https://api.github.com/users/GuardRex/received_events","type":"User","site_admin":false},"created_at":"2017-05-04T19:25:17Z","updated_at":"2017-05-04T19:25:17Z","body":"@BillWagner @rpetrusha \r\n\r\nSeems like this falls (loosely) under the \"rule:\"\r\n\r\n> You cannot return a ref to a variable whose lifetime does not extend beyond the execution of the method.\r\n\r\nThat's the prob, isn't it? ... that the referenced var may go out-of-scope if async were to be allowed (without a major rework of the way async works)?\r\n\r\n... if that's correct, then I wonder if that line could be extended, such as ...\r\n\r\n* You cannot return a ref to a variable whose lifetime does not extend beyond the execution of the method.\r\n  - That means you cannot return a reference to a local variable or similar scope. Along the same lines, `ref` locals and returns cannot be used with async methods, as the locally referenced variable may go out-of-scope before the async method returns.\r\n\r\n... or perhaps a 3rd \"rule\" can be added there (perhaps with a sub-bullet) ...\r\n\r\n* You cannot use `ref` locals and returns with async methods.\r\n  - A locally referenced variable may go out of scope before the async method returns, so async methods are disallowed for use with `ref` locals and returns."}}
{"actor":{"display_login":"GuardRex"}}