{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/4272","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/4272/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/4272/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/4272/events","html_url":"https://github.com/dotnet/roslyn/issues/4272","id":98469709,"number":4272,"title":"\"Use of unassigned local variable\" CS0165 issue","user":{"login":"mpmel","id":417561,"avatar_url":"https://avatars.githubusercontent.com/u/417561?v=3","gravatar_id":"","url":"https://api.github.com/users/mpmel","html_url":"https://github.com/mpmel","followers_url":"https://api.github.com/users/mpmel/followers","following_url":"https://api.github.com/users/mpmel/following{/other_user}","gists_url":"https://api.github.com/users/mpmel/gists{/gist_id}","starred_url":"https://api.github.com/users/mpmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpmel/subscriptions","organizations_url":"https://api.github.com/users/mpmel/orgs","repos_url":"https://api.github.com/users/mpmel/repos","events_url":"https://api.github.com/users/mpmel/events{/privacy}","received_events_url":"https://api.github.com/users/mpmel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Compilers","name":"Area-Compilers","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-31T20:55:53Z","updated_at":"2015-08-03T18:06:15Z","closed_at":"2015-08-03T18:06:15Z","body":"I'm getting a complaint in my code using VS 2015 and .Net 4.5.2, and am not quite understanding why.\r\n\r\nIf I call\r\n```csharp\r\nMyObject o;\r\nif (objects != null && objects.TryGetValue(objectName, out o))\r\n    v.Property= o;\r\n```\r\nthen everything is fine. The following two cases however give me an error, and I'm not quite understanding why.\r\n\r\n```csharp\r\nMyObject o;\r\nif (objects != null ? objects.TryGetValue(objectName, out o) : false)\r\n    v.Property= o; // <-- error CS0165: Use of Unassigned local variable 'o'\r\n```\r\nand\r\n```csharp\r\nMyObject o;\r\nbool b;\r\nif (objects != null)\r\n    b = objects.TryGetValue(objectName, out o);\r\nelse\r\n    b = false;\r\nif (b)\r\n    v.Property = o; // <-- error CS0165: Use of Unassigned local variable 'o'\r\n```\r\nIn either of the last 2 cases, I don't see how `o` can be used unless `TryGetValue` is called, which means `o` should be initialized.\r\n\r\nIs this a bug? Or I am I missing something?"}}