{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/autorest/issues/1166","repository_url":"https://api.github.com/repos/Azure/autorest","labels_url":"https://api.github.com/repos/Azure/autorest/issues/1166/labels{/name}","comments_url":"https://api.github.com/repos/Azure/autorest/issues/1166/comments","events_url":"https://api.github.com/repos/Azure/autorest/issues/1166/events","html_url":"https://github.com/Azure/autorest/issues/1166","id":160306503,"number":1166,"title":"Generated code does not handle a null response when there's no default in the responses section","user":{"login":"tbombach","id":779479,"avatar_url":"https://avatars.githubusercontent.com/u/779479?v=3","gravatar_id":"","url":"https://api.github.com/users/tbombach","html_url":"https://github.com/tbombach","followers_url":"https://api.github.com/users/tbombach/followers","following_url":"https://api.github.com/users/tbombach/following{/other_user}","gists_url":"https://api.github.com/users/tbombach/gists{/gist_id}","starred_url":"https://api.github.com/users/tbombach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbombach/subscriptions","organizations_url":"https://api.github.com/users/tbombach/orgs","repos_url":"https://api.github.com/users/tbombach/repos","events_url":"https://api.github.com/users/tbombach/events{/privacy}","received_events_url":"https://api.github.com/users/tbombach/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/autorest/labels/c%23","name":"c#","color":"178600"}],"state":"open","locked":false,"assignee":{"login":"tbombach","id":779479,"avatar_url":"https://avatars.githubusercontent.com/u/779479?v=3","gravatar_id":"","url":"https://api.github.com/users/tbombach","html_url":"https://github.com/tbombach","followers_url":"https://api.github.com/users/tbombach/followers","following_url":"https://api.github.com/users/tbombach/following{/other_user}","gists_url":"https://api.github.com/users/tbombach/gists{/gist_id}","starred_url":"https://api.github.com/users/tbombach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbombach/subscriptions","organizations_url":"https://api.github.com/users/tbombach/orgs","repos_url":"https://api.github.com/users/tbombach/repos","events_url":"https://api.github.com/users/tbombach/events{/privacy}","received_events_url":"https://api.github.com/users/tbombach/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Azure/autorest/milestones/6","html_url":"https://github.com/Azure/autorest/milestones/0.17.0","labels_url":"https://api.github.com/repos/Azure/autorest/milestones/6/labels","id":1644445,"number":6,"title":"0.17.0","description":"","creator":{"login":"devigned","id":386473,"avatar_url":"https://avatars.githubusercontent.com/u/386473?v=3","gravatar_id":"","url":"https://api.github.com/users/devigned","html_url":"https://github.com/devigned","followers_url":"https://api.github.com/users/devigned/followers","following_url":"https://api.github.com/users/devigned/following{/other_user}","gists_url":"https://api.github.com/users/devigned/gists{/gist_id}","starred_url":"https://api.github.com/users/devigned/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devigned/subscriptions","organizations_url":"https://api.github.com/users/devigned/orgs","repos_url":"https://api.github.com/users/devigned/repos","events_url":"https://api.github.com/users/devigned/events{/privacy}","received_events_url":"https://api.github.com/users/devigned/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":7,"state":"open","created_at":"2016-03-14T23:08:04Z","updated_at":"2016-06-15T20:55:34Z","due_on":"2016-06-15T07:00:00Z","closed_at":null},"comments":3,"created_at":"2016-06-14T23:20:39Z","updated_at":"2016-06-21T16:56:15Z","closed_at":null,"body":"If an operation doesn't define a default in the responses section, our fallback logic for handling unexpected status codes is to try to read the response content stream as a string:\r\nhttps://github.com/Azure/autorest/blob/master/AutoRest/Generators/CSharp/CSharp/Templates/MethodTemplate.cshtml#L296\r\n\r\n```\r\n            if ((int)_statusCode != 200 && (int)_statusCode != 204)\r\n            {\r\n                var ex = new CloudException(string.Format(\"Operation returned an invalid status code '{0}'\", _statusCode));\r\n                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);\r\n                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);\r\n                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);\r\n```\r\n\r\nHowever, if the Content property is null, this will throw a null reference exception."},"comment":{"url":"https://api.github.com/repos/Azure/autorest/issues/comments/227502852","html_url":"https://github.com/Azure/autorest/issues/1166#issuecomment-227502852","issue_url":"https://api.github.com/repos/Azure/autorest/issues/1166","id":227502852,"user":{"login":"tbombach","id":779479,"avatar_url":"https://avatars.githubusercontent.com/u/779479?v=3","gravatar_id":"","url":"https://api.github.com/users/tbombach","html_url":"https://github.com/tbombach","followers_url":"https://api.github.com/users/tbombach/followers","following_url":"https://api.github.com/users/tbombach/following{/other_user}","gists_url":"https://api.github.com/users/tbombach/gists{/gist_id}","starred_url":"https://api.github.com/users/tbombach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbombach/subscriptions","organizations_url":"https://api.github.com/users/tbombach/orgs","repos_url":"https://api.github.com/users/tbombach/repos","events_url":"https://api.github.com/users/tbombach/events{/privacy}","received_events_url":"https://api.github.com/users/tbombach/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T16:56:14Z","updated_at":"2016-06-21T16:56:14Z","body":"@pscofield I sent out a PR that I believe fixes this issue. Could you check if the null check fixes the problem in your code? (see my comment here for instructions: https://github.com/Azure/autorest/pull/1170#discussion_r67376399)"}}
{"actor":{"display_login":"tbombach"}}