{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/52088695","id":52088695,"diff_hunk":"@@ -56,9 +56,8 @@ protected ProjectId GetProjectId()\n \n         internal bool IsValidNode()\n         {\n-            var node = LookupNode();\n-\n-            if (node == null)\n+            SyntaxNode node;\n+            if (!TryLookupNode(out node) || node == null)","path":"src/VisualStudio/Core/Impl/CodeModel/InternalElements/AbstractCodeElement.cs","position":8,"original_position":8,"commit_id":"fef5e679bc135e1d84ea6a9168b8f94027abb1ac","original_commit_id":"fef5e679bc135e1d84ea6a9168b8f94027abb1ac","user":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"body":"Shouldn't TryLookupNode return false if node is null.  THen you don't need the || check.","created_at":"2016-02-05T23:49:56Z","updated_at":"2016-02-05T23:49:56Z","html_url":"https://github.com/dotnet/roslyn/pull/8424#discussion_r52088695","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/8424","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/52088695"},"html":{"href":"https://github.com/dotnet/roslyn/pull/8424#discussion_r52088695"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8424"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/8424","id":58494295,"html_url":"https://github.com/dotnet/roslyn/pull/8424","diff_url":"https://github.com/dotnet/roslyn/pull/8424.diff","patch_url":"https://github.com/dotnet/roslyn/pull/8424.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/8424","number":8424,"state":"open","locked":false,"title":"Code Model: Don't crash when adding element, deleting its text and then adding it again","user":{"login":"DustinCampbell","id":116161,"avatar_url":"https://avatars.githubusercontent.com/u/116161?v=3","gravatar_id":"","url":"https://api.github.com/users/DustinCampbell","html_url":"https://github.com/DustinCampbell","followers_url":"https://api.github.com/users/DustinCampbell/followers","following_url":"https://api.github.com/users/DustinCampbell/following{/other_user}","gists_url":"https://api.github.com/users/DustinCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/DustinCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DustinCampbell/subscriptions","organizations_url":"https://api.github.com/users/DustinCampbell/orgs","repos_url":"https://api.github.com/users/DustinCampbell/repos","events_url":"https://api.github.com/users/DustinCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/DustinCampbell/received_events","type":"User","site_admin":false},"body":"Fixes #8423\r\n\r\nIn Code Model, we weakly cache the code elements created by a FileCodeModel so long as they're alive. Elements are removed from the cache when they are deleted using Code Models APIs (e.g. `FileCodeModel.Remove(...)`) or during a clean up pass on idle. However, that means that it's possible to have collisions in the cache if a Code Model consumer does something so:\r\n\r\n1. Add an element, say a field called 'placeholder'.\r\n2. Replace the text of the element in the buffer.\r\n3. Add another field called 'placeholder'.\r\n\r\nThe steps above will likely result in a crash if the cache doesn't get cleaned up after the text is changed.\r\n\r\nThis PR adds code to check the cache before a new element is added. If an element with the same node key is found in the cache and that element is \"dead\" (that is, it's node key can't be resolved), we remove the old element from the cache.\r\n\r\nTagging @dotnet/roslyn-ide ","created_at":"2016-02-05T22:36:06Z","updated_at":"2016-02-05T23:49:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1069fb9bb642c6a21b6a6685a6b59b6bc219eea5","assignee":{"login":"DustinCampbell","id":116161,"avatar_url":"https://avatars.githubusercontent.com/u/116161?v=3","gravatar_id":"","url":"https://api.github.com/users/DustinCampbell","html_url":"https://github.com/DustinCampbell","followers_url":"https://api.github.com/users/DustinCampbell/followers","following_url":"https://api.github.com/users/DustinCampbell/following{/other_user}","gists_url":"https://api.github.com/users/DustinCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/DustinCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DustinCampbell/subscriptions","organizations_url":"https://api.github.com/users/DustinCampbell/orgs","repos_url":"https://api.github.com/users/DustinCampbell/repos","events_url":"https://api.github.com/users/DustinCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/DustinCampbell/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/4","html_url":"https://github.com/dotnet/roslyn/milestones/1.2","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/4/labels","id":937402,"number":4,"title":"1.2","description":"This is our 1.2 Milestone.\r\n\r\n<!---\r\n@huboard:{\"order\":2.0}\r\n-->\r\n","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":258,"closed_issues":451,"state":"open","created_at":"2015-01-15T20:48:55Z","updated_at":"2016-02-05T23:44:02Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/8424/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/8424/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/8424/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/fef5e679bc135e1d84ea6a9168b8f94027abb1ac","head":{"label":"DustinCampbell:issue-8423","ref":"issue-8423","sha":"fef5e679bc135e1d84ea6a9168b8f94027abb1ac","user":{"login":"DustinCampbell","id":116161,"avatar_url":"https://avatars.githubusercontent.com/u/116161?v=3","gravatar_id":"","url":"https://api.github.com/users/DustinCampbell","html_url":"https://github.com/DustinCampbell","followers_url":"https://api.github.com/users/DustinCampbell/followers","following_url":"https://api.github.com/users/DustinCampbell/following{/other_user}","gists_url":"https://api.github.com/users/DustinCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/DustinCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DustinCampbell/subscriptions","organizations_url":"https://api.github.com/users/DustinCampbell/orgs","repos_url":"https://api.github.com/users/DustinCampbell/repos","events_url":"https://api.github.com/users/DustinCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/DustinCampbell/received_events","type":"User","site_admin":false},"repo":{"id":30651839,"name":"roslyn","full_name":"DustinCampbell/roslyn","owner":{"login":"DustinCampbell","id":116161,"avatar_url":"https://avatars.githubusercontent.com/u/116161?v=3","gravatar_id":"","url":"https://api.github.com/users/DustinCampbell","html_url":"https://github.com/DustinCampbell","followers_url":"https://api.github.com/users/DustinCampbell/followers","following_url":"https://api.github.com/users/DustinCampbell/following{/other_user}","gists_url":"https://api.github.com/users/DustinCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/DustinCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DustinCampbell/subscriptions","organizations_url":"https://api.github.com/users/DustinCampbell/orgs","repos_url":"https://api.github.com/users/DustinCampbell/repos","events_url":"https://api.github.com/users/DustinCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/DustinCampbell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DustinCampbell/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/DustinCampbell/roslyn","forks_url":"https://api.github.com/repos/DustinCampbell/roslyn/forks","keys_url":"https://api.github.com/repos/DustinCampbell/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DustinCampbell/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DustinCampbell/roslyn/teams","hooks_url":"https://api.github.com/repos/DustinCampbell/roslyn/hooks","issue_events_url":"https://api.github.com/repos/DustinCampbell/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/DustinCampbell/roslyn/events","assignees_url":"https://api.github.com/repos/DustinCampbell/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/DustinCampbell/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/DustinCampbell/roslyn/tags","blobs_url":"https://api.github.com/repos/DustinCampbell/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DustinCampbell/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DustinCampbell/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/DustinCampbell/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DustinCampbell/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/DustinCampbell/roslyn/languages","stargazers_url":"https://api.github.com/repos/DustinCampbell/roslyn/stargazers","contributors_url":"https://api.github.com/repos/DustinCampbell/roslyn/contributors","subscribers_url":"https://api.github.com/repos/DustinCampbell/roslyn/subscribers","subscription_url":"https://api.github.com/repos/DustinCampbell/roslyn/subscription","commits_url":"https://api.github.com/repos/DustinCampbell/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/DustinCampbell/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/DustinCampbell/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/DustinCampbell/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/DustinCampbell/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/DustinCampbell/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DustinCampbell/roslyn/merges","archive_url":"https://api.github.com/repos/DustinCampbell/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DustinCampbell/roslyn/downloads","issues_url":"https://api.github.com/repos/DustinCampbell/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/DustinCampbell/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/DustinCampbell/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/DustinCampbell/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DustinCampbell/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/DustinCampbell/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/DustinCampbell/roslyn/deployments","created_at":"2015-02-11T14:36:20Z","updated_at":"2016-01-11T20:59:50Z","pushed_at":"2016-02-05T23:39:16Z","git_url":"git://github.com/DustinCampbell/roslyn.git","ssh_url":"git@github.com:DustinCampbell/roslyn.git","clone_url":"https://github.com/DustinCampbell/roslyn.git","svn_url":"https://github.com/DustinCampbell/roslyn","homepage":"","size":128218,"stargazers_count":0,"watchers_count":0,"language":"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":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"a0b3a016edd45e4b33f62058229e0d3e329a359f","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn/deployments","created_at":"2015-01-11T02:39:03Z","updated_at":"2016-02-05T22:55:27Z","pushed_at":"2016-02-05T23:40:17Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":154910,"stargazers_count":4378,"watchers_count":4378,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1073,"mirror_url":null,"open_issues_count":2030,"forks":1073,"open_issues":2030,"watchers":4378,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8424"},"html":{"href":"https://github.com/dotnet/roslyn/pull/8424"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/8424"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/8424/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8424/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8424/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/fef5e679bc135e1d84ea6a9168b8f94027abb1ac"}}}}