{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/16114","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/16114/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/16114/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/16114/events","html_url":"https://github.com/dotnet/roslyn/issues/16114","id":197762117,"number":16114,"title":"Null-Propagation Quick-Fix Suggests Invalid Fix","user":{"login":"333fred","id":2371880,"avatar_url":"https://avatars.githubusercontent.com/u/2371880?v=3","gravatar_id":"","url":"https://api.github.com/users/333fred","html_url":"https://github.com/333fred","followers_url":"https://api.github.com/users/333fred/followers","following_url":"https://api.github.com/users/333fred/following{/other_user}","gists_url":"https://api.github.com/users/333fred/gists{/gist_id}","starred_url":"https://api.github.com/users/333fred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/333fred/subscriptions","organizations_url":"https://api.github.com/users/333fred/orgs","repos_url":"https://api.github.com/users/333fred/repos","events_url":"https://api.github.com/users/333fred/events{/privacy}","received_events_url":"https://api.github.com/users/333fred/received_events","type":"User","site_admin":false},"labels":[{"id":166377917,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-IDE","name":"Area-IDE","color":"5319e7","default":false},{"id":165001069,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Bug","name":"Bug","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-27T21:46:38Z","updated_at":"2016-12-28T18:20:19Z","closed_at":null,"body":"**Version Used**: d15prerel/26022.07\r\n\r\nSimple example:\r\n\r\n```C#\r\nnamespace ConsoleApp1\r\n{\r\n    class Base\r\n    {\r\n        public Base(int i) { }\r\n    }\r\n\r\n    class Program : Base\r\n    {\r\n        public Program(string a) :\r\n            base(a != null ? a.Length : throw new ArgumentNullException(nameof(a)))\r\n        {\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThe IDE suggests moving `base(a != null ? a.Length : throw new ArgumentNullException(nameof(a)))` to use null propagation as follows: `base(a?.Length)`. This changes behavior, removing the ArgumentNullException, and it also no longer compiles, as `a?.Length` is an `int?`, not an `int`.\r\n\r\n/cc @Pilchie @dpoeschl "},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/269517545","html_url":"https://github.com/dotnet/roslyn/issues/16114#issuecomment-269517545","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/16114","id":269517545,"user":{"login":"333fred","id":2371880,"avatar_url":"https://avatars.githubusercontent.com/u/2371880?v=3","gravatar_id":"","url":"https://api.github.com/users/333fred","html_url":"https://github.com/333fred","followers_url":"https://api.github.com/users/333fred/followers","following_url":"https://api.github.com/users/333fred/following{/other_user}","gists_url":"https://api.github.com/users/333fred/gists{/gist_id}","starred_url":"https://api.github.com/users/333fred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/333fred/subscriptions","organizations_url":"https://api.github.com/users/333fred/orgs","repos_url":"https://api.github.com/users/333fred/repos","events_url":"https://api.github.com/users/333fred/events{/privacy}","received_events_url":"https://api.github.com/users/333fred/received_events","type":"User","site_admin":false},"created_at":"2016-12-28T18:20:19Z","updated_at":"2016-12-28T18:20:19Z","body":"@alrz that doesn't stop the change of behavior. If the original object isn't null, but the property is, `a?.Length ?? throw new ArgumentNullException(nameof(a))` will throw, but `a != null ? a.Length : throw new ArgumentNullException(nameof(a))` won't. You could use `(a ?? throw new ArgumentNullException(nameof(a))).Length`, but that looks terrible to me and is hard to parse visually."}}
{"actor":{"display_login":"333fred"}}