{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/24456284","id":24456284,"diff_hunk":"@@ -0,0 +1,121 @@\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using Xunit;\n+using System;\n+using System.Collections;\n+using System.Threading;\n+using System.Threading.Tasks;\n+\n+/// <summary>\n+/// the hashtable has a race:\n+///     A read operation on hashtable has three steps:\n+///        (1) calculate the hash and find the slot number.\n+///        (2) compare the hashcode, if equal, go to step 3. Otherwise end.\n+///        (3) compare the key, if equal, go to step 4. Otherwise end.\n+///        (4) return the value contained in the bucket.\n+///     The problem is that after step 3 and before step 4. A writer can kick in a remove the old item and add a new one \n+///     in the same bukcet. In order to make this happen easily, I created two long with same hashcode.\n+/// </summary>\n+public class ItemThreadSafetyTests\n+{\n+    private object _key1;\n+    private object _key2;\n+    private object _value1 = \"value1\";\n+    private object _value2 = \"value2\";\n+    private Hashtable _ht;\n+\n+    private bool _errorOccured = false;\n+    private bool _timeExpired = false;\n+\n+    private const long MAX_TEST_TIME_TICKS = 10L * 10000000L; // 10 seconds\n+\n+    [Fact]\n+    [OuterLoop]\n+    public void TestGetItemThreadSafety()\n+    {\n+        int i1 = 0x10;\n+        int i2 = 0x100;\n+        long l1;\n+        long l2;\n+\n+        //Setup key1 and key2 so they are different values but have the same hashcode\n+        //To produce a hashcode long XOR's the first 32bits with the last 32 bits\n+        l1 = (((long)i1) << 32) + i2;\n+        l2 = (((long)i2) << 32) + i1;\n+        _key1 = (object)l1;","path":"src/System.Collections.NonGeneric/tests/Hashtable/PropertyItemThreadSafety.cs","position":46,"original_position":46,"commit_id":"489b89fe2ed26360840f4f5b7d01e6ca5d7f4001","original_commit_id":"489b89fe2ed26360840f4f5b7d01e6ca5d7f4001","user":{"login":"bartonjs","id":10642668,"avatar_url":"https://avatars.githubusercontent.com/u/10642668?v=3","gravatar_id":"","url":"https://api.github.com/users/bartonjs","html_url":"https://github.com/bartonjs","followers_url":"https://api.github.com/users/bartonjs/followers","following_url":"https://api.github.com/users/bartonjs/following{/other_user}","gists_url":"https://api.github.com/users/bartonjs/gists{/gist_id}","starred_url":"https://api.github.com/users/bartonjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartonjs/subscriptions","organizations_url":"https://api.github.com/users/bartonjs/orgs","repos_url":"https://api.github.com/users/bartonjs/repos","events_url":"https://api.github.com/users/bartonjs/events{/privacy}","received_events_url":"https://api.github.com/users/bartonjs/received_events","type":"User","site_admin":false},"body":"Same as a previous comment: The functionality of this test is depending on long.GetHashCode's implementation. An assert to codify that dependency would ensure the test is kept up-to-date.","created_at":"2015-02-10T22:15:33Z","updated_at":"2015-02-10T22:15:33Z","html_url":"https://github.com/dotnet/corefx/pull/712#discussion_r24456284","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/712","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/24456284"},"html":{"href":"https://github.com/dotnet/corefx/pull/712#discussion_r24456284"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/712"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/712","id":28969486,"html_url":"https://github.com/dotnet/corefx/pull/712","diff_url":"https://github.com/dotnet/corefx/pull/712.diff","patch_url":"https://github.com/dotnet/corefx/pull/712.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/712","number":712,"state":"open","locked":false,"title":"Add, modify and enable tests of Hashtable, SortedList, etc.","user":{"login":"YingP99","id":9558545,"avatar_url":"https://avatars.githubusercontent.com/u/9558545?v=3","gravatar_id":"","url":"https://api.github.com/users/YingP99","html_url":"https://github.com/YingP99","followers_url":"https://api.github.com/users/YingP99/followers","following_url":"https://api.github.com/users/YingP99/following{/other_user}","gists_url":"https://api.github.com/users/YingP99/gists{/gist_id}","starred_url":"https://api.github.com/users/YingP99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YingP99/subscriptions","organizations_url":"https://api.github.com/users/YingP99/orgs","repos_url":"https://api.github.com/users/YingP99/repos","events_url":"https://api.github.com/users/YingP99/events{/privacy}","received_events_url":"https://api.github.com/users/YingP99/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-10T00:09:27Z","updated_at":"2015-02-10T22:15:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ebb610e9603fdcb120d23b152d3246623634694","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/712/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/712/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/712/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/489b89fe2ed26360840f4f5b7d01e6ca5d7f4001","head":{"label":"YingP99:nongeneric","ref":"nongeneric","sha":"489b89fe2ed26360840f4f5b7d01e6ca5d7f4001","user":{"login":"YingP99","id":9558545,"avatar_url":"https://avatars.githubusercontent.com/u/9558545?v=3","gravatar_id":"","url":"https://api.github.com/users/YingP99","html_url":"https://github.com/YingP99","followers_url":"https://api.github.com/users/YingP99/followers","following_url":"https://api.github.com/users/YingP99/following{/other_user}","gists_url":"https://api.github.com/users/YingP99/gists{/gist_id}","starred_url":"https://api.github.com/users/YingP99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YingP99/subscriptions","organizations_url":"https://api.github.com/users/YingP99/orgs","repos_url":"https://api.github.com/users/YingP99/repos","events_url":"https://api.github.com/users/YingP99/events{/privacy}","received_events_url":"https://api.github.com/users/YingP99/received_events","type":"User","site_admin":false},"repo":{"id":26613367,"name":"corefx","full_name":"YingP99/corefx","owner":{"login":"YingP99","id":9558545,"avatar_url":"https://avatars.githubusercontent.com/u/9558545?v=3","gravatar_id":"","url":"https://api.github.com/users/YingP99","html_url":"https://github.com/YingP99","followers_url":"https://api.github.com/users/YingP99/followers","following_url":"https://api.github.com/users/YingP99/following{/other_user}","gists_url":"https://api.github.com/users/YingP99/gists{/gist_id}","starred_url":"https://api.github.com/users/YingP99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YingP99/subscriptions","organizations_url":"https://api.github.com/users/YingP99/orgs","repos_url":"https://api.github.com/users/YingP99/repos","events_url":"https://api.github.com/users/YingP99/events{/privacy}","received_events_url":"https://api.github.com/users/YingP99/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/YingP99/corefx","description":"This repository contains the foundational libraries that make up the .NET Core development stack.","fork":true,"url":"https://api.github.com/repos/YingP99/corefx","forks_url":"https://api.github.com/repos/YingP99/corefx/forks","keys_url":"https://api.github.com/repos/YingP99/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YingP99/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YingP99/corefx/teams","hooks_url":"https://api.github.com/repos/YingP99/corefx/hooks","issue_events_url":"https://api.github.com/repos/YingP99/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/YingP99/corefx/events","assignees_url":"https://api.github.com/repos/YingP99/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/YingP99/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/YingP99/corefx/tags","blobs_url":"https://api.github.com/repos/YingP99/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YingP99/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YingP99/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/YingP99/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YingP99/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/YingP99/corefx/languages","stargazers_url":"https://api.github.com/repos/YingP99/corefx/stargazers","contributors_url":"https://api.github.com/repos/YingP99/corefx/contributors","subscribers_url":"https://api.github.com/repos/YingP99/corefx/subscribers","subscription_url":"https://api.github.com/repos/YingP99/corefx/subscription","commits_url":"https://api.github.com/repos/YingP99/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/YingP99/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/YingP99/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/YingP99/corefx/issues/comments/{number}","contents_url":"https://api.github.com/repos/YingP99/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/YingP99/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YingP99/corefx/merges","archive_url":"https://api.github.com/repos/YingP99/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YingP99/corefx/downloads","issues_url":"https://api.github.com/repos/YingP99/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/YingP99/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/YingP99/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/YingP99/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YingP99/corefx/labels{/name}","releases_url":"https://api.github.com/repos/YingP99/corefx/releases{/id}","created_at":"2014-11-13T23:41:36Z","updated_at":"2015-01-24T00:45:14Z","pushed_at":"2015-02-10T00:05:47Z","git_url":"git://github.com/YingP99/corefx.git","ssh_url":"git@github.com:YingP99/corefx.git","clone_url":"https://github.com/YingP99/corefx.git","svn_url":"https://github.com/YingP99/corefx","homepage":"","size":7842,"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:v1.0","ref":"v1.0","sha":"3c3bf10bba38b23c4cd38716e7e7019231ffd9fc","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":26295345,"name":"corefx","full_name":"dotnet/corefx","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/corefx","description":"This repo contains the foundational libraries that make up the .NET Core development stack.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments/{number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","created_at":"2014-11-06T23:42:48Z","updated_at":"2015-02-10T21:20:51Z","pushed_at":"2015-02-10T21:13:42Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"","size":19457,"stargazers_count":6898,"watchers_count":6898,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1245,"mirror_url":null,"open_issues_count":145,"forks":1245,"open_issues":145,"watchers":6898,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/712"},"html":{"href":"https://github.com/dotnet/corefx/pull/712"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/712"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/712/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/712/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/712/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/489b89fe2ed26360840f4f5b7d01e6ca5d7f4001"}}}}